Question

Where is the documentation for sending hypermedia to AWS through the API ?

  • 27 January 2022
  • 7 replies
  • 157 views

Badge

I see the endpoint firing, and I see how that stream is constructed from the attachments sample, but it doesn’t use the normal Api endpoint auth, it only returns 403 Unauthorized whenever I try.

/api/_/attachments is the endpoint I’m referring to. How do we Authenticate with it ?


7 replies

Badge

I see the endpoint firing, and I see how that stream is constructed from the attachments sample, but it doesn’t use the normal Api endpoint auth, it only returns 403 Unauthorized whenever I try.

/api/_/attachments is the endpoint I’m referring to. How do we Authenticate with it ?

I’m trying to mass migrate our knowledge base into our Freshdesk deployment, and move the images for those solution articles with them. I’ve already sent the documents themselves, the final step is to update the image references which I need this endpoint to do.

The solutions api does not contain any documentation about submitting attachments to the articles, but when you do it manually, you see this as the endpoint that fires that data out. How can I make use of this so I can mass translate the image references and save on the manual labor of doing that ? 

Badge

Why are these relevant help articles redirecting to Refresh ?

 

Insert Attachment Alongside Solution Article

Adding attachments to solution articles through API

This is functionality that already exists within Freshdesk, with the lack of any reply in any of the contact methods I’ve tried reaching out to you on this topic, it’s starting to seem like you’re trying to avoid this. 

 

What is going on here ? Talk to me. 

Userlevel 5
Badge +12

Hello @Taylor, this is Keer from Freshworks Community team. Our apologies for the delay in getting back to you on this thread and we certainly are not trying to abandon this topic. We are here to help. I see you are trying to add images to solutuion articles via API and this indeed is possible. 

 

You have to ensure the image is publicly hosted post which you can make use of the same ‘Create Solution Article’ API call, tweak the description to include the image. 

 

{
"title": "sample article with API",
"description": "this is a sample article with some <img src='https://snipboard.io/rFEiRh1.jpg' alt='hehe'>",
"status": 1
}

Adding a quick screengrab from POSTMAN for your reference below: 

Add images to solution articles via API

 

I hope this helps. Let me know if you have any more queries. Have a great day!  

 

Badge

This in no way addressed the functionality that I asked about. 

I’m already aware of how to add images to HTML, that wasn’t the question at all. For someone to know what an API call is, it’s rather strange for you to assume they don’t know how to insert an image into the HTML. That’s like finding someone who just replaced a car’s engine but doesn’t know how to change the oil, or someone built a new computer but doesn’t know how to install a CPU. It’s essentially prerequisite knowledge to the action being performed, of course I know how to insert images into HTML. Can we move beyond this pettiness and actually address the issue I’m inquiring about ? I promise I’m not typing to bore you, but only provide relevant information. But now, because I feel there’s a communication problem, I’m going to go overboard. Please read it all. I’m sorry.

Freshdesk Solutions Article Editor includes a way to *upload* locally stored images (that is images stored on my C, D, A, or Z drives) to the Amazon AWS Services. This happens when you open any article in a solution and edit it, and drag and drop an image to the WYSIWYG Editor, and using Fiddler or any browser’s network inspector, I can see the endpoint from our Freshdesk deployment at /api/_/attachments firing to send the image. This is what I want. I want that endpoint, that takes an image, and returns a url. I can work with this.

This endpoint is entirely undocumented in the Freshdesk API document, however, there is an identical call occurring that adds attachments to tickets. This functionality works fine for me, I can build the data stream no problem. It does not exist on the Solutions endpoints, I’ve tried, nothing in docs suggested it would. 

So all I have is this single undocumented endpoint to mass migrate images from the existing knowledge base, which is hosting its own images, to the new knowledge base, which needs to host its own images. Doing it through Amazon AWS is fine, but I want access to that endpoint because I’m not manually uploading all of them. It’s too much work, and I can’t efficaciously do things like check to see if that guid has already been sent (preventing duplication of hypermedia, there are reused images, so this is useful)

This endpoint doesn’t use the Basic Authentication as outlined in the Freshdesk API docs (Authorization: Basic Convert.ToStringBase64(`${apikey}:X`)), instead it uses a cookie to authenticate. So in order to access this, I require the documentation for authenticating to work with this endpoint. 

The reason why this matters is the existing knowledge bases will be shut down once we finalize our Freshdesk deployment, we can’t have those images being broken. Additionally, future and existing articles will mostly be edited using WYSIWYG from our staff, so when they upload images, they will have Amazon AWS urls, but existing images for migrated docs will have soon-to-expire links. 

Help me figure this out, please. Thank you. 

Badge

As far as I can tell, the answer is basically that you can’t.  The endpoints that authenticate via API keys are under /api/v2/, but /api/_/ is private just for internal Freshdesk use only and requires cookies and possibly other headers that aren’t in the public API docs.  You’d probably have to make a feature request for them to create a public endpoint for solution article attachment upload.

Probably if I were in your shoes, I’d spider to download all the files from the old KB, preserving the folder structure, then upload it all to a host I control somewhere else (my own S3 bucket or whatever), and then just replace the domain for all the images to the new one before uploading the articles via API to Freshdesk.  So all these old images would be on a different webhost than any newly-uploaded ones, but it should still work fine and should probably be less work.

The /api/_/attachments endpoint you're referring to seems to be related to some kind of API used for handling attachments, but without specific context, it's a bit challenging to provide exact instructions for authentication. However, I can give you a general overview of how API authentication might work and how you can approach it.

APIs typically use various methods for authentication to ensure secure access to their endpoints. Some common methods include:

  1. API Keys: You provide an API key along with your API request. The server validates the key and grants access if it's valid.

  2. Bearer Tokens: You obtain a token (usually after a login process) and include it in your API requests using the "Bearer" authentication scheme.

  3. OAuth: A more complex but powerful method where you obtain tokens that allow access to specific resources on behalf of a user.

  4. Basic Authentication: You send your credentials (username and password) encoded in the request header.

  5. Session Cookies: You authenticate by maintaining a session using cookies, often utilized in web applications.

Since you're encountering a 403 Unauthorized error, it suggests that your current method of authentication is not working or not properly set up for the /api/_/attachments endpoint.

Here's a general process you might follow to authenticate with an API endpoint:

  1. Obtain Authentication Information: Check the API documentation or any available guides to understand how authentication should be handled for the /api/_/attachments endpoint. They should specify which method to use and any required parameters.

  2. Generate Necessary Credentials: Depending on the authentication method, you might need to generate an API key, obtain a token, or use existing credentials.

  3. Include Authentication Information in Requests: Modify your API request to include the required authentication information. This might involve adding headers, query parameters, or request body elements.

  4. Test and Debug: If you're still getting a 403 Unauthorized error, double-check the credentials you're using, the method you're using for authentication, and the way you're including authentication information in your request.

  5. Reach Out for Help: If you're still having trouble, consider reaching out to the API provider's support or developer community for assistance. They might be able to provide specific guidance based on their authentication system.

Remember that every API might have its own specific requirements for authentication, so it's important to consult the API documentation or contact the API provider for accurate and detailed instructions.

Badge +1

To discover documentation on sending hypermedia to AWS thru the API, you may desire to refer to the legit AWS documentation and resources. AWS presents a large vary of offerings and APIs, every with its personal set of documentation. To in particular deal with hypermedia, you would possibly want to discover AWS offerings associated to APIs, such as Amazon API Gateway or AWS App Runner.

Here's a typical method on how you ought to navigate the documentation to reap this:

Identify the Service: Determine which AWS provider you are the usage of or planning to use for sending hypermedia via the API. Common offerings for constructing APIs encompass Amazon API Gateway, AWS Lambda, AWS App Runner, etc.

Access the Documentation: Go to the AWS Documentation internet site (docs.aws.amazon.com) and use the search bar to locate the documentation for the precise provider you are working with. For example, if you are the use of Amazon API Gateway, search for "Amazon API Gateway documentation".

Browse or Search: The documentation hub for the chosen provider need to have complete statistics on how to use it. Browse thru the documentation sections or use the search characteristic to locate subjects associated to sending hypermedia. This may encompass data about response formats, content material types, and customization options.

Hypermedia and API Responses: Look for sections that talk about API responses and content material negotiation. Hypermedia commonly entails controlling the structure and content material of the responses that your API sends again to clients. You may discover important points about how to shape your API's responses to consist of hypermedia links, metadata, and associated resources.

Examples and Tutorials: Many AWS documentation pages consist of realistic examples and tutorials. These can be immensely useful in grasp how to put into effect hypermedia elements in your API. Follow step-by-step publications or take a look at code snippets to see how hypermedia can be protected in API responses.

Reply