REST API - Get Document PDF

Do you want to create a native client or integrate with third party applications: webservices are the solution.

Moderator: car031

Locked
ldiego162
Posts: 4
Joined: Wed Aug 09, 2017 9:41 am

REST API - Get Document PDF

Post by ldiego162 » Wed Aug 09, 2017 9:55 am

Hi everyone

I want integrate my system with LogicalDoc. I want get the documents use the REST API, I use example the getContent service an only return the document in application/octet-stream,but I want download the document in the specific format, example .pdf. The other service getDocument , return JSON or XML but only with the document information.

The solution I found is created a interface with java , call the getContent and transform the content to pdf

My applicaction > interface > LogicalDoc
pdf < convert < application/octet-stream

LogicalDoc dont have this utility and I dont need created a interface to convert ?

Best Regards

Diego

admin
Site Admin
Posts: 13
Joined: Mon Apr 19, 2010 2:20 pm

Re: REST API - Get Document PDF

Post by admin » Wed Aug 09, 2017 10:23 am

Hi Diego,
currently through REST methods you can not convert a document from one format to another,
but using the SOAP web services you can request the conversion of a document to PDF and then download it.

The methods to invoke are 2:
createPdf -> performs the creation of a PDF resource if it doesn't exist yet (conversion)
getResource -> returns the requested content resource (if it exists)

See also the documentation online http://docs.logicaldoc.com/en/web-services-api

Please note that conversion to PDF is only available in commercial versions of LogicalDOC, not in the Community edition.

We may eventually bring these 2 methods to the REST API, but we are planning to introduce a new Enterprise Web Service that will include a generic method to convert a document from one format to another

Cristian

ldiego162
Posts: 4
Joined: Wed Aug 09, 2017 9:41 am

Re: REST API - Get Document PDF

Post by ldiego162 » Wed Aug 09, 2017 10:35 am

Hi Cristian,

Thanks for you quickly reply. In this moment a do it some analysis and test with different DMS solutions for a project in my company. I have done a some pdf documents in the Logical Doc database and only want download. How I can test the Enterprise version ?

About the prices Logical Doc in enterprise, can you help about this?

Best Regards

Diego

admin
Site Admin
Posts: 13
Joined: Mon Apr 19, 2010 2:20 pm

Re: REST API - Get Document PDF

Post by admin » Wed Aug 09, 2017 11:15 am

Hi Diego,
you may request to download the trial version by filling out the form on the official website https://www.logicaldoc.com/try

As for the prices you can request a quotation to the following address https://www.logicaldoc.com/quote

Br.
Cristian

ldiego162
Posts: 4
Joined: Wed Aug 09, 2017 9:41 am

Re: REST API - Get Document PDF

Post by ldiego162 » Wed Aug 09, 2017 5:45 pm

Hi Again Christian,

I read again your answer and I dont want convert the document one format to other format, only I want download the document in the same format I already saved. Example I have pdf documents in the DMS and I want only download ( off course with the format), it is possible with a web services?

Best Regards

Diego

agaspa
Posts: 521
Joined: Tue Apr 20, 2010 8:24 am

Re: REST API - Get Document PDF

Post by agaspa » Thu Aug 10, 2017 9:25 am

Hi Diego,
with the rest method getContent you can download the content of a document (file)

For more details
http://wiki.logicaldoc.com/wiki/RESTful_Guide_with_curl

Basically using curl from cmd line

Code: Select all

curl -u admin:admin http://localhost:8080/services/rest/document/getContent?docId=456456456
Output to a file on the FS

Code: Select all

curl -u admin:admin http://localhost:8080/services/rest/document/getContent?docId=456456456 > myFile.pdf
Note if you don't know the filename you will have first to read the document metdata using method getDocument

Code: Select all

curl -u admin:admin -H "Accept: application/json" http://localhost:8080/services/rest/document/getDocument?docId=114884608
Br.
Alex

ldiego162
Posts: 4
Joined: Wed Aug 09, 2017 9:41 am

Re: REST API - Get Document PDF

Post by ldiego162 » Thu Aug 10, 2017 4:14 pm

Hi Alex,

I saw before the command line use the curl, but i search a solution with normal web services call ( example from Explorer or Firefox) and download the file with the format is storage in the DMS. But I saw the API don't have this possibility, Only get Content in binary file. :(

Regards

Diego

agaspa
Posts: 521
Joined: Tue Apr 20, 2010 8:24 am

Re: REST API - Get Document PDF

Post by agaspa » Fri Aug 11, 2017 8:55 am

Hi Diego,
from the browser you can use the download servlet,
but you will have to pass the session ID (sid) as well the docId params

eg.:

Code: Select all

http://localhost:8080/download?docId=2219&sid=213456241564251
Note: if you're already logged in the system will read a cookie and doesn't need the sid

Locked

Who is online

Users browsing this forum: No registered users and 1 guest