Skip to content
Sourcebox API Reference
Manage Document getAttachments
latest

Manage Document getAttachments🔗

The getAttachments action retrieves all attachments related to a document by ID, packaged as a zip file. This is only available for persisting accounts.

Manage Document getAttachments parameters

Parameter Description Content type
account the Sourcebox account name text
username the username of the user text
password the password associated to the user text
trxmlid the trxml id of the document to be retrieved number
externalid the external id of the document to be retrieved, as an alternative to trxmlid text

Note

trxmlid is a unique ID automatically assigned by Sourcebox to a document when sent for parsing or indexing to Search. To link a document to an ID from an external system, such as an ATS, use externalid.

The input document selector is either:

  • trxmlid or
  • externalid

The service accepts only one of these arguments. When externalid is supplied and there are multiple documents in sourcebox containing this externalid then the latest document is returned: the one with the highest trxmlid.

The service supports MTOM optimization which can be enabled by setting the request header.

Content-Type: application/xop+xml;charset=UTF-8;type="text/xml"

The zip file containing the attachments can also retrieved with a POST request with application/x-www-form-urlencoded parameters from the following URL:

https://home.textkernel.nl/sourcebox/manageDocument

The service is identical to the get action.

Example usage of the POST request with application/x-www-form-urlencoded parameters

curl "https://home.textkernel.nl/sourcebox/manageDocument"
    --data account=test --data username=test --data password=xyz --data trxmlid=5
    --data action=getattachments

curl "https://home.textkernel.nl/sourcebox/manageDocument"
       --data account=test --data username=test --data password=xyz --data externalid=a8
       --data action=getattachments

Error codes🔗

Below are the possible error codes returned by the getAttachments action. In case of the REST getAttachments service the servlet returns different HTTP status codes. In case of SOAP the HTTP status code on error is always 500.

Manage Document getAttachments Errors

Error Code Description Servlet status code
INVALID_ACTION Invalid HTTP method for this action. 400
INVALID_ARGUMENT Only for the HTTP REST service: action must be get, getAttachments or delete. 400
INVALID_CREDENTIALS Combination of account, username and password is invalid. 401
DOCUMENT_NOT_FOUND No document found with the given trxml ID or external ID. 404
DOCUMENT_ACCESS_DENIED Access to the document is prohibited to the account/username. 403
FILE_NOT_FOUND The original document cannot be found on the file system. 404
TEMPLATING_ERROR The Textractor templator encountered an error. 500
OTHER A system fault. 500