Skip to content
  • There are no suggestions because the search field is empty.

API: Attachments and Print Copies

The following article will cover how to use the API to configure Content Attachments and Print Copies Analysts.

 

🔔Note: Please note that the most efficient way to retrieve a list of products is by providing the UpdatedSince parameter when calling GET ~/api/v1/products .

Reading files

To read attachments, you can GET ~/api/v1/libraries/reports/products/{productCode}/attachments/{fileCode}.

To read a print copy, you can download the default for each supported filetype (doc, pdf, xls or ppt) by calling GET ~/api/v1/libraries/reports/products/{productCode}/printcopies/{extension}. If a print copy has been uploaded with that filetype, it will be returned, otherwise it will fall back to generating the default print copy (if any).

If a more recent version of the Office document has been uploaded (docx, pptx, xlsx), then it will be returned when requesting the traditional extensions (doc, ppt, xls). This follows the same behaviour as the UI.

If you don’t want a generated print copy, or if there is ambiguity, you can specify a specific file to download by providing the fileCode query parameter.

🔔Note:  The fileCode parameter can be retrieved by calling GET ~/api/v1/libraries/reports/products/{productCode} with includeToc set to true.

Uploading files

To upload attachments and print copies, use POST ~/api/v1/libraries/reports/products/{productCode}/imports.

The request should contain two parts, one with Content-Disposition: form-data; name=”upload”; filename=”{filename}” and one with Content-Disposition: form-data; name=”upload_data”.

The “upload” part should also have a Content-Type header to match the file you want to import.

The contents of the part should be the raw contents of the file you want to import.

The “upload_data” part should contain a JSON object with one property “importType”. The “importType” property can take values “MainDeliverable”, “Attachment” or “PrintCopy”.

🚨Warning: This endpoint does not accept Content-Type: application/json. Your request must be Content-Type: multipart/form-data.

 

🚨Warning:  This operation only stores the uploaded file and validates that it could be processed.

It does not process it immediately.

You must call: ~/api/v1/libraries/reports/products/{productCode}/imports/{id} until it returns “stage”: “Complete” for the file to be processed.

Removing files

To remove an attachment, you can call DELETE ~/api/v1/libraries/reports/products/{productCode}/attachments/{fileCode}.

To remove a print copy, you can call DELETE ~/api/v1/libraries/reports/products/{productCode}/print-copy-files/{fileCode}.

 

🔔Note:  The fileCode parameter can be retrieved by calling GET ~/api/v1/libraries/reports/products/{productCode} with includeToc set to true.