jarlei | 2021-10-29 14:09:31 UTC | #1
Hi Folks!
I'm working on a project that will need to download files from genesys cloud.
A third-party application needs to download files to use them on a page that the customer can download.
I saw that there is the API /api/v2/contentmanagement/documents/{documentId}/content to this end.
My problem is when downloading the document using contentLocationUri I have the return:
<Error> <Code>AccessDenied</Code> <Message>Request has expired</Message> <X-Amz-Expires>20</X-Amz-Expires> <Expires>2021-10-29T13:34:56Z</Expires> <ServerTime>2021-10-29T14:04:51Z</ServerTime> <RequestId>ECA0A6G0JRKBSXYN</RequestId> <HostId> mgie/0EuPBsDRz52KPq2mjkzUrDXWbYX7pJytQug+i36a41jzwiNcfj160Hc4vsYiVu0967qzuw= </HostId> </Error>
I'm calling passing disposition = attachment (already tried as inline)
Any tips or examples on how to get the files' download url via a third party application?
Thank you in advance for the forum help
Jerome.Saint-Marc | 2021-10-29 20:23:49 UTC | #2
Hello,
The URL you get in contentLocationUri has a limited lifetime (signed signature/token with limited duration for its validity). The document/file is made available on AWS and I see that the url contains X-Amz-Expires=20. Which means that you likely have 20 seconds to start the download of the file.
After it expires, you can request /api/v2/contentmanagement/documents/{documentId}/content endpoint again, and it will give you a new url (new signature/token valid for next 20 seconds).
Regards,
jarlei | 2021-10-29 15:42:53 UTC | #3
Hi @Jerome.Saint-Marc , thx a lot for your quick reply 🦾
what's the difference between disposition types (attachment and inline) ?
To load the file on a html page should i use "inline"?
Greetings
Jerome.Saint-Marc | 2021-10-29 20:23:49 UTC | #4
From what I understand (I have just run the query with inline and attachment): With inline, the request to the contentLocationUri returns HTML (document data embedded in html/body elements). With attachment, it returns the document data.
"To load the file on a html page should i use "inline"?" I would say both would work - it just depends what you do with the contentLocationUri you get in your web page/javascript. If you want to display the document in a new tab, with no special/additional javascript code or html formatting, or in an iframe, you could indeed use inline and it will give you an HTML page you can display directly/as is.
Regards,
system | 2021-11-29 16:00:37 UTC | #5
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 12510