5.2.48 /api/v1/documents

This API endpoint is used to inspect or modify the backend's list of documents.

Supported HTTP methods: GET, POST, PATCH, HEAD, OPTIONS

GET /api/v1/documents/{documentId}

Gets the documents item with the given ID.

Parameters:

Parameter Description
documentId The documentId of the item to get

Expected Payload: none.

Replied Payload: An DocumentItem record with the given ID. The DocumentItem does not contain its 'fileContent' field, use the '/api/v1/documents/content/' API call to retrieve the document content.

Return Codes:

Code Description
200 OK, the requested DocumentItem document is returned.
401 Not logged in. In this case an ApiError document is returned, describing details of the error.
404 No DocumentItem with this ID exists or the backend does not support the inventory database. In this case an ApiError document is returned, describing details of the error.

POST /api/v1/documents

Creates a new DocumentItem entry in the database.

Parameters: none.

Expected Payload:An DocumentItem record containing the fields of the record to create. The following rules apply:

Replied Payload: The created DocumentItem record. The DocumentItem does not contain its 'fileContent' field, use the '/api/v1/documents/content/' API call to retrieve the document content.

Return Codes:

Code Description
200 OK, the modified DocumentItem document is returned.
400 The file already exists. In this case the file is not written and an ApiError document is returned, describing details of the error.
401 Not logged in. In this case an ApiError document is returned, describing details of the error.
404 No DocumentItem with this ID exists or the backend does not support the inventory database. In this case an ApiError document is returned, describing details of the error.
500 DB is not writable. In this case an ApiError document is returned,describing details of the error.

PATCH /api/v1/documents/{documentId}

Modifies the documents item with the given ID.

Parameters:

Parameter Description
documentId The documentId of the item to modify

Expected Payload:An DocumentItem record containing the fields to modify. The following rules apply:

Replied Payload: The DocumentItem record after modification. The DocumentItem does not contain its 'fileContent' field, use the '/api/v1/documents/content/' API call to retrieve the document content.

Return Codes:

Code Description
200 OK, the modified DocumentItem document is returned.
400 A file with the new name already exists. In this case the file is not written and an ApiError document is returned, describing details of the error.
401 Not logged in. In this case an ApiError document is returned, describing details of the error.
404 No DocumentItem with this ID exists or the backend does not support the documents database. In this case an ApiError document is returned, describing details of the error.
500 DB is not writable. In this case an ApiError document is returned,describing details of the error.

DELETE /api/v1/documents/{documentId}

Deletes the documents item with the given ID. This also deletes the file this record refers to.

Parameters:

Parameter Description
documentId The documentId of the item to delete

Expected Payload: none.

Replied Payload: none.

Return Codes:

Code Description
204 OK, the addressed DocumentItem has been deleted.
401 Not logged in. In this case an ApiError document is returned, describing details of the error.
404 No DocumentItem with this ID exists or the backend does not support the inventory database. In this case an ApiError document is returned, describing details of the error.
500 DB is not writable. In this case an ApiError document is returned,describing details of the error.

GET /api/v1/documents/content/{documentId}

Gets the file content of the document item with the given ID.

Parameters:

Parameter Description
documentId The documentId of the item to get

Expected Payload: none.

Replied Payload: The file content of the data file this document record refers to.

Return Codes:

Code Description
200 OK, the requested file is returned.
401 Not logged in. In this case an ApiError document is returned, describing details of the error.
404 No DocumentItem with this ID exists or the backend does not support the inventory database. In this case an ApiError document is returned, describing details of the error.

POST /api/v1/documents/list

Gets a list of documents items matching the filter information sent with the request.

Parameters: none

Expected Payload: An DocumentItem document containing the filter to be applied. Any fields in the document which are missing or null are intepreted as a wildcard. Specified fields must all match to include the item in the returned list. If a 'modified' timestamp is given in the filter description, it is interpreted as 'must be modified at this time or later'. The 'fileContent' field is ignored as a filter.

Replied Payload: An array of DocumentItem records fulfilling the filter spec. The list is sorted by file name, 'a' to 'z'. The DocumentItem records do not contain their 'fileContent' field, this API call is intended to list the items, not to to execute a bulk read of the documents.

Return Codes:

Code Description
200 OK, the requested DocumentItem array is returned.
401 Not logged in. In this case an ApiError document is returned, describing details of the error.
404 The backend does not support the inventory database. In this case an ApiError document is returned, describing details of the error.