Displaying thumbnails
When getting search results from /ask
or /find
, the retrieved resources may have a thumbnail
attribute.
It has the following format:
/kb/<KB_ID>/resource/<RESOURCE_ID>/<FIELD_TYPE>/<FIELD_ID>/download/extracted/file_thumbnail
To get the corresponding URL, you need to prefix it with the regional API base URL:
https://<REGION>.rag.progress.cloud/api/v1/kb/<KB_ID>/resource/<RESOURCE_ID>/<FIELD_TYPE>/<FIELD_ID>/download/extracted/file_thumbnail
When your Knowledge Box is private (which is almost always what you want), if you try to access it directly, you just get a 403 error saying No roles could be resolved for AnonymousUser anonymous at …
.
Of course, you could load the corresponding image using the regular authentication methods provided by Agentic RAG (like API keys or User keys).
But as you usually want to put this URL in an image tag like:
<img src="the-thumbnail-url" />
you will not be able to set HTTP headers programmatically as you usually do when making calls to the API.
In that case, the solution is to use an ephemeral token.
You will need to make an authenticated POST to the /ephemeral_tokens
endpoint on the regional API:
POST https://<REGION>.rag.progress.cloud/api/v1/account/<ACCOUNT_ID>/kb/<KB_ID>/ephemeral_tokens
It will return a token that can be passed as query string parameter to the thumbnail url to obtain the file:
https://<REGION>.rag.progress.cloud/api/v1/<THUMBNAIL_PATH>?eph-token=<TOKEN>
It can work for any type of files stored in Agentic RAG. For example, if you want to display a file stored in a FieldField using a specific viewer (PDF viewer, media player, etc.), you would use the exact same technique.