Updating Records in Bulk
Updating records through the Bulk API is slightly different from creating them. The main difference is that you'll need to provide two extra fields with each object: identifier_field_name
and identifier_field_value
.
Attribute | Description | Notes |
---|---|---|
identifier_field_name | The name of the attribute to use for lookup | Typically id , but could be vin or name for the vehicle resource. |
identifier_field_value | The lookup attribute's value |
note
You may use multiple, mixed identifier_field_name
values for a single Bulk API job.
Example
We have three vehicles which already exist in Fleetio and we want to update them. We can look up each record using different Identifier Fields.
We will submit a POST
request to /api/v1/bulk_api_jobs
with this body:
{
"resource":"vehicle",
"operation":"update",
"records":[
{
/* update vehicle based on vin matching "12345678901234567" */
"identifier_field_name":"vin",
"identifier_field_value":"12345678901234567",
/* The following fields are applied to the update */
"name":"A new vehicle name",
"color": "Blue",
/* ... */
},
{
/* update vehicle based on name matching "Current vehicle name" */
"identifier_field_name":"name",
"identifier_field_value":"Current vehicle name",
/* The following fields are applied to the update */
"name":"Another new vehicle name",
"color": "Black",
/* ... */
},
{
/* update vehicle based on id matching 123 */
"identifier_field_name":"id",
"identifier_field_value":123,
/* The following fields are applied to the update */
"name":"A third new vehicle name",
"color": "Red",
/* ... */
}
]
}