![]() |
API Documentation
|
This page describes how to use Covata's API to:
Notes:
- Before creating either a Secure Object or a collection (collectively called an item), your application must have a valid access token obtained by authenticating and authorizing a Covata user to the Covata Platform, where this user has the appropriate role and/or permissions to create either:
For more information about authenticating and authorizing Covata users to the Covata Platform, see Authorizing your application on the Authentication and authorization page of this guide and the Configuring client applications page of the Covata Platform Administrator's Guide.
- their own items or
- items within another Covata user's collection.
- The Supported roles (and permissions) sections of each API endpoint page (linked to from the procedures below) contain details about the roles and permissions that a Covata user requires for a successful request to the endpoint (along with a valid access token representing this user).
A Secure Object (in its Created or 'completed' state) represents a file's data which has been encrypted (according to Covata's encryption requirements), along with the encrypted file's associated attributes/metadata (which are recorded by the Covata Platform's Access Service).
A Secure Object's content is only handled either by the Covata Platform's Content Service or externally by your application. A Secure Object's content is not handled by the Covata Platform's Access Service. However, a Secure Object's associated attributes/metadata can be retrieved from the Access Service, which in turn can assist in:
Tip: Conceptually and in Covata's Safe Share applications, Secure Objects represent files.
Notes:
- A Secure Object in an Incomplete state is one that has been initialized (and associated with a key), although is not yet associated with any encrypted data (which would change the Secure Object's state to Created).
- When using Covata Safe Share applications, an incomplete Secure Object could also result from a failure in either encrypting the Secure Object's data or uploading its content to storage.
- In Covata Administration, a Secure Object's current state can be seen through the Files page. For more information, see the Covata Platform Administrator's Guide.
A collection:
Collections are:
Tip: In Covata's Safe Share applications, collections represent folders.
An item (in the context of Secure Objects and collections) is a generic term that refers to either a Secure Object or a collection.
Every item, regardless of whether it is a Secure Object or a collection has a unique identifier (or ID).
A cryptographic key is required to encrypt data into a complete Secure Object.
To obtain a cryptographic key from the Covata Platform's Access Service (which is the first step before creating a new Secure Object), make a POST request to the <access-service>/api/v1/keys API endpoint with a JSON object in the body of the request that either:
128, 192 or 256. 256.Example request: Initiating a request to obtain a cryptographic key:
Note: As indicated in this example, the access token obtained when you authorized your application must be included in the header of this request (as the bearer token) for the request to succeed.
If your request (above) was sent successfully, the Covata Platform responds by sending back a JSON object containing the key's ID value (required to associate a cryptographic key with a Secure Object), other information about the key's characteristics and a date and time stamp of when the key was created.
Example response: Response from the Covata Platform upon successfully processing a client application's request for a cryptographic key:
Next step: Now that you have a cryptographic key, you can begin the process of creating a new Secure Object. This involves either:
Initializing a new Secure Object (whose state is Incomplete):
To do this, make a POST request to the <access-service>/api/v1/objects API endpoint with a JSON object in the body of the request that contains the keyId parameter (as a name/value pair) whose value is the ID of the key (obtained above).
The ID of the incomplete Secure Object is returned in the response to this request.
Tip: Your application may wish to temporarily store this ID value as it is used for completing a Secure Object, either by locally encrypting its data and then uploading it for storage, or by uploading its unencrypted data for encryption and storage.
Next step: Now that you have initialized your Secure Object, you can begin encrypting its data. Depending on your application's requirements, this involves either:
Creating a completed Secure Object from locally-encrypted data involves the following steps:
Requirements for encrypting data locally
When encrypting your data using the cryptographic key (obtained above), then ensure that this data is encrypted using:
If you do not follow these requirements, then either your attempt to upload your encrypted data may fail or if successful, any attempt to download the Secure Object's data in its decrypted form will result in the retrieval of garbled data.
Completing the Secure Object
To complete a Secure Object (whose state is Created) from its locally encrypted data, make either a:
PUT request to the <access-service>/api/v1/objects/{objectId} endpoint with: POST request to the <access-service>/api/v1/objects API endpoint with a JSON object in the body of the request that contains: In both of these cases, a SHA-512 value must be associated with the Secure Object to set its state to Created.
Next step: Depending on your application's requirements, follow one of these procedures:
Once a Secure Object's data has been encrypted locally (above) and the Secure Object's state has changed to Created, your application can send this encrypted data to remote storage via the Covata Platform's Content Service.
To upload a completed Secure Object's encrypted data to the Content Service, make a POST request to the <content-service>/api/v1/objects/{objectId}/contents API endpoint, along with the actual encrypted data to be uploaded.
When making this request, the value of the format URL parameter must be encrypted. See Required parameters on POST of <content-service>/api/v1/objects/{objectId}/contents for more information.
Note: If the data being uploaded is larger than the upload chunk size permitted by the Covata Platform (whose default value is 10 mebibytes), then the data must be uploaded in multiple requests to this endpoint. For more information, see Required parameters for multi-chunk uploads of <content-service>/api/v1/objects/{objectId}/contents.
Next step: Depending on your application's requirements, follow one of these procedures:
Creating a completed Secure Object from unencrypted data stored locally involves the following steps:
To upload an incomplete Secure Object's unencrypted data to the Content Service, make a POST request to the <content-service>/api/v1/objects/{objectId}/contents API endpoint, along with the actual unencrypted data to be uploaded.
However, when making this request, the value of the format URL parameter must be plaintext. See Required parameters on POST of <content-service>/api/v1/objects/{objectId}/contents for more information.
Note: If the data being uploaded is larger than the upload chunk size permitted by the Covata Platform (whose default value is 10 mebibytes), then the data must be uploaded in multiple requests to this endpoint. For more information, see Required parameters for multi-chunk uploads of <content-service>/api/v1/objects/{objectId}/contents.
After completing all required requests to upload the unencrypted data, the Content Service automatically:
Note: For a multi-chunk upload, steps 1 to 3 above are conducted for each chunk and after the last chunk has been uploaded, the final SHA-512 value (for the entire encrypted data) is calculated and associated with the Secure Object.
Next step: Depending on your application's requirements, follow one of these procedures:
Collections are used for logically organizing Secure Objects and other collections, which the Covata Platform's Content Service utilizes for organise files and folders for Covata users.
To create a collection, make a POST request to the <access-service>/api/v1/collections API endpoint with the name of the collection and the parentId value, both of which are parameters (each specified as name/value pairs) within a JSON object in the body of the request. The parentId value should be:
0 to specify that the new collection will be created at the logical root level, orTip: A new Secure Object can be created within an existing collection by specifying the parentId value when making the appropriate API endpoint call to either:
- Initialize the Secure Object or
- Complete the Secure Object by encrypting its data locally.
If a Secure Object's unencrypted data is to be uploaded to the Covata Platform's Content Service, specify the parentId value when initializing the Secure Object.