Files Bulk

Cloud Elements Bulk API calls provide an option to upload a large number of records into a Cloud Service all at once. The Bulk APIs require the name of the object identified within the cloud service and a file (.csv, .xls, .xlsx, JSONL) with populated data included in each request. Cloud Elements provides discovery services to get a list of available objects.

If you configured the Callback Notification Signature Key (event.notification.signature.key) when you authenticated an element instance, the bulk APIs will use the signature key to provide hash verification in the header of bulk jobs. For more information, see Hash Verification.

First we make the GET /objects call to retrieve the object which, in other words, is the file you uploaded. 

curl -X GET
-H 'Authorization: Element <INSERT ELEMENT TOKEN>, User <INSERT_USER_SECRET>'
'https://api.cloud-elements.com/elements/api-v2/hubs/general/objects'

Example of a Successful Response:

[
  "accounts"
]

We place "accounts" in our request URL to perform our bulk upload. 

A file with populated data is required in our request, like the one seen below.

Example data will be used in this demonstration.

Sample CSV Data

A sample request can be seen below.:

curl -X POST
-H 'Authorization: Element <INSERT ELEMENT TOKEN>, User <INSERT_USER_SECRET>'
-F file=@sample.csv
'https://api.cloud-elements.com/elements/api-v2/hubs/general/bulk/accounts?path=/sample.csv'

Example of Successful Response:

{
  "id": "1234",
  "status": "CREATED"
}

An id is assigned to job. This can be used to check the status of a bulk job.

The id “1234” will be used in the request URL in the next example.

curl -X GET
-H 'Authorization: Element <INSERT ELEMENT TOKEN>, User <INSERT_USER_SECRET>'
'https://api.cloud-elements.com/elements/api-v2/hubs/general/bulk/1234/status'

Example of Successful Response:

{
  "id": "1234",
  "status": "COMPLETE"
}

Once the job is completed, login to the cloud service and find the updated file with the newly added records.

Note: You can perform a bulk upload only on one object at a time, as you can upload only one file in one instance.