Cells Update Data
This endpoint allows you to update entries or create entries (upsert). You're able to update up to 10,000 fields per call. When working with this endpoint you would benefit from having a function that is able to partition your data into correct batches (examples provided below). If any data in a batch is invalid the entire batch fails. If you would like to have partial success you can build a function that removes failed entries from a batch and performs a retry(example provided below).
Swagger
Params
name | Parameter type | Data Type | Values | Description |
---|---|---|---|---|
entryTypeId | Path | string or int | company or 2011 | the unique identifier of the entry type |
Body
{
"storeRequests": [
{
"entryId" (integer, required),
"fieldId" (integer, required),
"ignoreNearDups" (boolean, optional),
"value" (object, optional)
}
]
}
Requests
When updating existing entries, EntryId should be set to a valid number. Valid EntryIds are always positive integer.
PUT {{host}}/api/rest/v4/data/entrydata/{{entryTypeId}} HTTP/1.1
Content-Type: application/json
Authorization: {{auth}}
{
"storeRequests": [
{
"value": "Created Via API",
"ignoreNearDups": true,
"entryId": 3045615,
"fieldId": 2300
},
{
"value": "Second Field",
"ignoreNearDups": true,
"entryId": 3045615,
"fieldId": 2227
}
]
}
Working with binary data
The fieldId used in the binaryStoreRequest should be of type 13 or 16.
PUT {{baseUrl}}/api/rest/v4/data/entrydata/{{entryTypeId}} HTTP/1.1
Authorization: {{auth}}
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="model"
Content-Type: application/json
{
"binaryStoreRequests": [
{
"formatType": "jpg",
"contentType": "image/jpg",
"name": "Headshot.jpg",
"entryId": 3045615,
"fieldId": 9569
}
]
}
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="attachment"; filename="Headshot.jpg"
Content-Type: image/jpg
< ./1.jpg
------WebKitFormBoundary7MA4YWxkTrZu0gW--
Working with multiple binary data
Filename should match value in name field.
PUT {{baseUrl}}/api/rest/v4/data/entrydata/{{entryTypeId}} HTTP/1.1
Authorization: {{auth}}
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="model"
Content-Type: application/json
{
"binaryStoreRequests": [
{
"formatType": "jpg",
"contentType": "image/jpg",
"name": "Headshot.jpg",
"entryId": 3045615,
"fieldId": 9569
},
{
"formatType": "jpg",
"contentType": "image/jpg",
"name": "Headshot2.jpg",
"entryId": 3045615,
"fieldId": 9569
}
]
}
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="attachment"; filename="Headshot.jpg"
Content-Type: image/jpg
< ./1.jpg
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="attachment"; filename="Headshot2.jpg"
Content-Type: image/jpg
< ./2.jpg
------WebKitFormBoundary7MA4YWxkTrZu0gW--
Working with mixed data
The fieldId used in the binaryStoreRequest should be of type 13 or 16.
PUT {{baseUrl}}/api/rest/v4/data/entrydata/{{entryTypeId}} HTTP/1.1
Authorization: {{auth}}
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="model"
Content-Type: application/json
{
"storeRequests": [
{
"value": "Created Via API",
"ignoreNearDups": true,
"entryId": 3045615,
"fieldId": 2300
},
{
"value": "Second Field",
"ignoreNearDups": true,
"entryId": 3045615,
"fieldId": 2227
}
],
"binaryStoreRequests": [
{
"formatType": "jpg",
"contentType": "image/jpg",
"name": "Headshot.jpg",
"entryId": 3045615,
"fieldId": 9569
}
]
}
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="attachment"; filename="Headshot.jpg"
Content-Type: image/jpg
< ./1.jpg
------WebKitFormBoundary7MA4YWxkTrZu0gW--
Working with large data-sets
When working with large data-sets, its best to reduce the number of calls. The best strategy is to get your batch size as close to 10,000 as possible. Its best to create 2 functions, BatchByEntryId and Update.
C# BatchByEntryId Example DefaultBatchSize should = 10000
public static List<List<int>> BatchByEntryId(this IEnumerable<int> allPushRequests)
{
List<List<int>> batchedPushRequests = new List<List<int>>();
var dcPushes = allPushRequests.ToList();
for (int i = 0; i < dcPushes.Count; i += DefaultBatchSize)
{
var batch = (dcPushes.GetRange(i, Math.Min(DefaultBatchSize, dcPushes.Count - i)));
batchedPushRequests.Add(batch);
}
return batchedPushRequests;
}
C# ChunkCreateRequests With Retries On Error
Below if a requests contains entries with error, the errored entries are removed and the entries without errors are retried.
public static async Task<ChunkProcessSchema> ChunkProcessBulkDataUpdateRequestsAsync(this IntappAPIClient intappClient,
IEnumerable<DataRequestBase> pushRequests,
int entryListId,
bool retryFailedRequests = true)
{
var dcPushes = pushRequests.ToList();
var schema = await intappClient.ProcessUpdateRequestAsync(dcPushes, entryListId);
// If errors were encountered, determine which entries did not produce errors and retry them separately
if (schema.allRequestsWithErrors.Count > 0)
{
IEnumerable<DataRequestBase> requestsWithoutErrors = dcPushes
.Where(x => schema.allRequestsWithErrors.All(result => result.EntryId != x.EntryId));
var withoutErrors = requestsWithoutErrors.ToList();
if (retryFailedRequests && withoutErrors.Any())
{
schema.retryAttempt = await intappClient.ProcessUpdateRequestAsync(withoutErrors, entryListId);
}
}
return schema;
}
Response
HTTP/1.1 200 OK
[
{
"entryId": 3045615,
"fieldId": 2300,
"rowId": 3045615,
"isNoData": false,
"value": "Created Via API"
},
{
"entryId": 3045615,
"fieldId": 2227,
"rowId": 3045615,
"isNoData": false,
"value": "Second Field"
}
]