You are viewing limited content. For full access, please sign in.

Question

Question

Laserfiche Cloud API Get Request for Document

asked on July 23, 2021 Show version history

I am attempting to use the Laserfiche Cloud API to download a PDF from the repository. I am able to authenticate in via the API using a python script, however when I run the following line of code, 

document = requests.get('https://api.laserfiche.com/repository/v1-alpha/Repositories/REPOSITORY ID/Entries/41745/Laserfiche.Repository.Document.edoc', headers = {'Authorization':'Bearer ' + AuthToken})

print('+++++++Get Document JSON Response+++++++')
print(document.json())
print('\n')
print('+++++++Get Document Response Headers+++++++')
print(document.headers)

 

I get the following error responses:

 

+++++++Get Document JSON Response+++++++
{'error': {'code': 'UnsupportedApiVersion', 'message': "The HTTP resource that matches the request URI 'http://api.laserfiche.com/repository/v1-alpha/Repositories/REPOSITORY ID/Entries/41745/Laserfiche.Repository.Document.edoc' with API version '1-alpha' does not support HTTP method 'GET'.", 'innerError': None}}


+++++++Get Document Response Headers+++++++
{'Date': 'Fri, 23 Jul 2021 19:10:59 GMT', 'Content-Type': 'application/json; charset=utf-8', 'Content-Length': '304', 'Connection': 'keep-alive', 'Allow': 'POST', 'api-supported-versions': '1-alpha, 1', 'X-RequestId': 'c7de7ffa987040ab9651fa1176c1e07e', 'Strict-Transport-Security': 'max-age=15552000; includeSubdomains', 'X-OperationID': 'ecd5018895b956e54804fb1ed5d08d6a'}

 

Any help or advice would be appreciated.

 

Justin

0 0

Answer

SELECTED ANSWER
replied on July 23, 2021

I was able to return a correct call by updating the python script as follows: 

document = requests.get('https://api.laserfiche.com/repository/v1-alpha/Repositories/REPOSITORY ID/Entries/41745/Laserfiche.Repository.Document/edoc', headers = {'Authorization':'Bearer ' + AuthToken,'Accept':'application/octet-stream,application/json'})

print('+++++++Get Document Response Headers+++++++')
print(document.headers)

 

5 0

Replies

You are not allowed to reply in this post.
You are not allowed to follow up in this post.

Sign in to reply to this post.