Using Zoho CRM's POST /bulk/{objectName} API
The Zoho CRM V2 element offers a new bulk endpoint, POST /bulk/{objectName}
, which can be used to bulk create, update, or upsert multiple records at the same time. These records can be given as an input in the form of a JSON file.
Apart from the JSON file as input, you need to also include two other parameters in your call:
objectName
, the object on which the bulk job will be performedmetaData
, a unique value to indicate insert, update, or upsert; refer to the following table for specifics:Bulk Job Type Required metaData
ValueInsert {"action":"insert"} Update {"primaryKeyName":"<primary-key-field-name>","action":"update"} Upsert {"primaryKeyName":"<primary-key-field-name>","action":"upsert"}
You can check the status of the above bulk operations by first noting down the id
from the response of the above POST /bulk/{objectName} endpoint and then giving the same id
as an input to the endpoint GET /bulk/{id}/status. The newly updated or created records can be verified in the respective objects’ GET endpoints.
For detailed vendor documentation of the POST /bulk/{objectName} endpoint, see Zoho's documentation.
Using Cloud Elements Bulk APIs
Cloud Elements bulk API calls provide an option to upload a large number of resources, such as contacts, into a Cloud Service all at once. The Bulk APIs require the name of the object identified within the cloud service and a .csv file 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 will make the GET /objects call to retrieve a list of available objects
curl -X GET
-H 'Authorization: Element <INSERT ELEMENT TOKEN>, User <INSERT_USER_SECRET>'
'https://api.cloud-elements.com/elements/api-v2/hubs/marketing/objects'
Example of Successful Response:
[
"activities",
"contact",
"campaign",
"list",
"account"
]
The “contact” object is available. We will use contact in our bulk upload. It will be placed in our request URL.
A csv file with populated data is required in our request, like the one seen below.
Example data will be used in this demonstration.
An Example 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/marketing/bulk/contact?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/marketing/bulk/1234/status'
Example of Successful Response:
{
"id": "1234",
"status": "COMPLETE"
}
Once the job is completed, login to the cloud service an find your newly created contacts.