Skip Navigation
Constructing the URL of an article attachment from the Knowledge Advanced REST API
Answer ID 11396   |   Last Review Date 04/02/2020

What is the URL to access a file attachment from an article retrieved via Content REST?


Integrations using the Knowledge Advanced REST API v1


From the content object response, parse two values:

  1. The resourcePath.
  2. The filename(s) from the xml, which your application should URL encode.

Concatenate the resourcePath and desired filename together. If the attachment has a user group association, a kmauthtoken must be sent in the header with the GET request for the attachment.


A request to get the content:

curl --location --request GET --header 'Accept: application/json' \
--header 'kmauthtoken: {"localeId":"en_US", "siteName":"my_site", "integrationUserToken":"[token]"}' \

The necessary elements of the response (the XML will, of course, vary according to your content type schema):

{ [...],
"xml":"<DEMO><TITLE><![CDATA[Answer with attachment]]></TITLE>
    <CONTENT><TEXT><![CDATA[This article has an attachment.]]></TEXT>
    <ATTACHMENT SIZE=\"1095\"><![CDATA[five.png]]></ATTACHMENT></CONTENT></DEMO>",

Finally, the request for the attachment:

curl --location --request GET --output five.png \
--header 'kmauthtoken: {"localeId":"en_US", "siteName":"my_site", "integrationUserToken":"[token]"}' \