Web API to get document by document ID

Certified Associate Developer

Hi,

I need to create a web api which would take document ID as input and should give the document.  I tried using document download function in the web api and the response I am getting is as follows:

[@attributes=[@anyAttribute=[_documentDownloadLink:ioBHxsE-N_JZt_4edZOQWnRVKO7BA2EyyDE3f8W5ryXvpMCFErFIBm5KMo], @nil=], document=[Document:117890], label=loan, actions=, version=-1]

How can I get the document from here?  

I also created the web api to download the document where the response is the url like "">mysite.com/.../56831"

But I do not want to get the link to download the document.  

Is there any other way to get the document through web api?  

Thanks in advance,

Brinda Sateesh.

  Discussion posts and replies are publicly visible

Parents
  • Hi Stefan, I have a requirement wherein we have two environments  - one on cloud and one on premise and documents are stored in cloud environment. I've stored the document ids in the database. The on-premise users have to download certain files from cloud environment.  What is the best way to implement this?  I've tried using  the document link as web api and downloading it using safe url. but authentication cannot be done in this way. Please suggest some work around 

  • So, your issue is that your users hav no permission to access the cloud env, right? Then, you could start a process via startProcessLink which the user clicks on. The document is downloaded via in that process and a chained task form shows the download link.

    Does that help?

  • Using document id stored in database ,Through safe url, i can download files from my on-premise site (that are stored in cloud env). This happens only when i logged in to cloud env also. When I logged out from cloud env, i'm unable to download the document. I get the below error message on a new browser tab:

    {"resource":"\/suite\/webapi\/downloadReports\/12229","error":"APNX-1-4187-000","message":"Authentication failed. Please check your credentials and try again.","title":"An Error Has Occurred"}
Reply
  • Using document id stored in database ,Through safe url, i can download files from my on-premise site (that are stored in cloud env). This happens only when i logged in to cloud env also. When I logged out from cloud env, i'm unable to download the document. I get the below error message on a new browser tab:

    {"resource":"\/suite\/webapi\/downloadReports\/12229","error":"APNX-1-4187-000","message":"Authentication failed. Please check your credentials and try again.","title":"An Error Has Occurred"}
Children