Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

 

Code Block
languagejs
themeRDark
 {"message": "STORAGE_UNIT_DOESNT_EXIST"}

 

Delete If Status

Returns the current status of the delete if processing execution for the storage unit.

Request

The delete if status GET request will return a JSON with the current status of the deleteif processing that has been previously executed.

Code Block
languagetext
 GET transaction/deleteIfStatus/id

Response

A 200 response code is received and the current status with the number of deleted items and/or errors.

 

Code Block
languagejs
themeRDark
 {"message":{"status":"complete","deleteCount":1}}

Put File

Uploads a file to a file specific scope. Files can only be uploaded to scopes that don't previously exist, or that already contain files. Put file uses multipart/form-data format to upload the file. Metadata associated with the file can also be specified as multipart/form-data fields.

Request

The put file PUT/POST multipart/form-data request URL requires the storageunit, record key and the scope where the file will be uploaded. The request multipart/form-data body requires at least a file field with the file reference. By default the version for the file will be set to 1 and the policy will be merge (same policies as the add action policies). To specify additional metadata for the file, add other multipart/form-data text fields to the request.

Code Block
languagetext
PUT transaction/putFile/<storage-unit>/<key>/<scope>

Headers:

  • Content-type: multipart/form-data;boundary=BOUNDARY_TOKEN

Body:

  • file: File type field where the file is specified. The filename will be used as the file identifier when requesting back the file.
  • version: A version to chronologically identify the file transactions. If a file with the same filename already exists with a higher version, the filename will not be added.
  • policy: The policy to use when adding a file:
    • new: only adds the file doesn't exist in the scope.
    • overwrite: if a file with the same name already exists, it overwrites all of it's previous metadata and updates the file.
    • merge: if a file with the same name already exists, it adds any new metadata to the file metadata, overwrites existing metadata for that file.
  • additional metadata: any other field in the request will be considered file metadata and saved as such. The field name can have the filename as a prefix, separated by a colon.

Response

If the file is uploaded correctly, a 200 response code and an OK message are returned.

 

Code Block
languagejs
themeRDark
 {"message":"OK"}

Multiple File Upload

Using the same putFile request, multiple files can be uploaded at once to the same scope of a storage unit.

To upload multiple files, the multpart/form-data request accepts multiple entries of the file field.

To specify metadata specific to a file, add the file name as a prefix to the metadata fields for that file, including version and policy. If a prefix is not specified, the field is considered general and it is added as metadata for all files.

Body Sample:

fieldvalue
filefile1.jpg
filefile2.jpg
file1.jpg:version1
file2.jpg:version4
policymerge
file1.jpg:titlelogo
descriptionLogo image

In this example, two files will be added:

  • file1.jpg: 
    • version = 1
    • policy = merge
    • title = logo
    • description = Logo image
  • file2.jpg (no title field)
    • version = 4
    • policy = merge
    • description = Logo image