iSheets API version 2 - iSheet module - API - Generate site-wide/single-record document
OVERVIEW
This API is designed for downloading site-wide and single-record documents from iSheet.
Step 1 -
Site-wide document end-point
/api/3/isheet/doctemplate/generatedocument/sitewide/{doctemplateid}?isheetid={isheetid}&isheetrecordids={isheetrecordids}
Single-record report end-point
/api/3/isheet/doctemplate/generatedocument/singlerecord/{doctemplateid}?isheetid={isheetid}&viewid={viewid}&isheetrecordid={isheetrecordid}
doctemplateid |
|
|
isheetid |
|
ID of the iSheet |
isheetrecordid |
|
isheetrecordid is necessary for single-record document
|
isheetrecordids |
String (CSV of iSheet record ids) | This is an optional parameter. If the record ID was not found, all records will be returned in an exported file. |
viewid | number |
viewid (isheet view id) is necessary for a single-record document |
Response:
If generating a document that is in progress
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<progressivekeyresponse>
<progressivekeystatus>INPROGRESS</progressivekeystatus>
</progressivekeyresponse>
If generating a document that is now complete
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<progressivekeyresponse>
<progressivekeystatus>DONE</progressivekeystatus>
<downloadlink>https://local.com/sitepont/api/<apiversion>/isheet/doctemplate/generatedocument/110/download/key=13648</downloadlink>
</progressivekeyresponse>
Step 2 - Get progress key from Step 1 then check the progress key status
To download the generated doc template use the below end-point. The key can be found from the response in step 1.
/api/3/progressivekeystatus/{key}
Response:
If generating a document that is in progress
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<progressivekeyresponse>
<progressivekeystatus>INPROGRESS</progressivekeystatus>
</progressivekeyresponse>
If generating a document that is now complete
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<progressivekeyresponse>
<progressivekeystatus>DONE</progressivekeystatus>
<downloadlink>https://local.com/sitepont/api/<apiversion>/isheet/doctemplate/generatedocument/110/download/key=13648<13648</downloadlink>
</progressivekeyresponse>
Response : Binary stream of document
Response Code
Code | Meaning |
---|---|
200 | Document found |
400 |
Problem with parsing XML or JSON object (Bad Request) |
401 | Unauthorised |
403 | Validation failed/ Forbidden |
404 | The document doesn't exist in the system |
405 | Method not allowed (calling API with the wrong method) |
500 | An internal error occurred while getting document content |
Note : If the iSheet doc template is configured with the setting 'Download document' checked (this can be found in the add/edit manage document template page) then '<downloadlink> will be returned in the response.
Updating Step 2 - Get progress key from Step 1 then check the progress key status. The documentation was out of date, we now call the PRK in the same way we would elsewhere in the application.
Andrew Quinn thanks for providing more details, the development team have found out the cause of this issue and are working on a fix now. We will update the Sandbox instance in the coming week or so to get this issue sorted.
Thanks Imran Aziz,
This is happening everytime I call this now. This is the end point called:
GET https://integrationbeta.highq.com/integrationbeta/api/3/isheet/doctemplate/generatedocument/singlerecord/2?isheetid=34&viewid=68&isheetrecordid=166103 HTTP/1.1 Accept: application/json Auth-Type: OAUTH2 Authorization: Bearer *************************** (redacted) host: integrationbeta.highq.com Connection: close
And this is the response:
HTTP/1.1 400 400 Date: Fri, 26 Jan 2018 01:41:43 GMT Server: Apache Cache-Control: no-cache, no-store Pragma: no-cache X-XSS-Protection: 1; mode=block Strict-Transport-Security: max-age=31536000; includeSubDomains X-Content-Type-Options: nosniff X-Ratelimit-Limit: 500 X-Ratelimit-Remaining: 495 X-Ratelimit-Reset: 1516930911 X-Ratelimit-Relative-Reset: 7 Expires: Thu, 01 Jan 1970 00:00:00 GMT Content-Type: text/plain;charset=utf-8 Content-Length: 156 Connection: close Multiple fields representing property "items": com.os.api.dbo.ProgressiveKeyDBO#itemsErrorsDBO vs com.os.api.dbo.ProgressiveKeyDBO#isheetItemDeleteStatusDBO
Andrew Quinn thanks for raising the bug, will get out engineering team to look into this issue.
Imran Aziz - are you able to help Andrew Quinn with the queries mentioned above please? Thank you.
Andrew Quinn - I have adjusted the typo. Thank you for letting us know.
Every now and then when calling the end point API with the same details (i.e. when testing) I get the following response back from the server:
Multiple fields representing property "items": com.os.api.dbo.ProgressiveKeyDBO#itemsErrorsDBO vs com.os.api.dbo.ProgressiveKeyDBO#isheetItemDeleteStatusDBO
Not wrapped in JSON or XML, just a straight response written out. Can a dev @ HighQ shed light on this error message? Thanks, Andrew
FYI,
Call /instance/api/3/progressivekeystatus/{key} where {key} is the progressive key returned from the initial call.
See iSheet item - create for more details about the Progressive Key response object.
Single-record report end-point has typo: .../singlerecord/{doctemplateid}?sheetid={isheetid}&viewed...
This should be 'isheetid=': .../singlerecord/{doctemplateid}?isheetid={isheetid}&viewed...
Comments
9 Comments