The Add Document API allows you to add a single document to an existing ZetaSafe Object. Documents can be uploaded to;
You will need to provide the corresponding ZetaSafe PK (Primary Key) to which you wish to upload the document to, and also have a valid x-Auth-token allowing you access to the particular object.
URI
Development
Production
Method
POST
Content Type
application/json
Body
Required Fields:
file
id
type
Document Upload Example:
{
"bytes": "###",
"id": "###",
"fileName": "###",
"type": "###"
"metadata":"###"
}
Example with data. The ** bytes** data below has been reduced in size in this example. A real base64 encoded file should be added.
{
"bytes": "I1+FUur3UoiSC7QyQKZMZxuzCc4z09eetdWAq4lSVCq0136\/kceKp0re0grH\/\/Z",
"id": 1021661584,
"fileName": "EF531E45-D227-4B07-A896-3C73BC805BE4.jpg",
"type": "ASSET_NOTE",
“metadata”: “{\“status\“:\“Status\“,\“expiryDate\“:\“2019-09-30\“,\“keywords\“:\“stuff\“,\“description\“:\“Waterfall\“, \“virtualPath\”:[\“Folder 1\", \“Folder 2\”, \“Folder 3\"] }”
}
id is the ZetaSafe PK of the document destination
fileName is the filename (including file Extension)
bytes contains a base 64 encoded file
type is the type of the document, the possible values are
The metadata contains information about the document. This needs to be sent a a string . Notice the slightly different format of the metadata in the JSON.
The virtualPath is an array of text denoting the folder folder structure the document is under. If the virtual path does not already exist it will be created.
Metadata String Example
“metadata”: “{\“status\“:\“Status\“,\“expiryDate\“:\“2019-09-30\“,\“keywords\“:\“stuff\“,\“description\“:\“Waterfall\“, \“virtualPath\”:[\“Folder 1\", \“Folder 2\”, \“Folder 3\"] }”
Responses:
201: Success
{"recordId":"38ef8602-4a64-4218-8147-37ff571b426e"}
400: Bad Request - an explanation is returned
{"message":"There is already a document with the file name 'blob.txt' at Array/of/text",
"title":"Document already exists",
"breadcrumbEnabled":true,
"headings":[{"key":"ok","value":"OK"}],
"result":"DUPLICATE_DOCUMENT",
"affected":null,
"offendingSlaves":null}
403: Unauthorised/Access Denied
{
"timestamp": 1555322863458,
"status": 403,
"error": "Forbidden",
"message": "Access Denied",
"path": "/v1/note/advanced/handheld/add"
}
500: Error with the internal process of editing an asset.