Cells Create Data
This endpoint allows you to create new Entries. You're able to create 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 | Body | json | the json body of the request |
Payload
{
"storeRequests": [
{
"entryId" (integer, required),
"fieldId" (integer, required),
"ignoreNearDups" (boolean, optional),
"value" (string | number | object, optional)
}
]
}
Requests
When generating new entries, EntryId should be set to a invalid number. Since valid EntryIds are always positive integer you can default to using negative numbers for EntryIds.
Working with text data
POST {{host}}/api/rest/v4/data/entrydata/{{entryTypeId}} HTTP/1.1
Content-Type: application/json
Authorization: {{auth}}
{
"storeRequests": [
{
"value": "Created Via API",
"ignoreNearDups": true,
"entryId": -1,
"fieldId": 2300
},
{
"value": "Second Field",
"ignoreNearDups": true,
"entryId": -1,
"fieldId": 2227
}
]
}
Working with binary data
The fieldId used in the binaryStoreRequest should be of type 13 or 16. See more about DealCloud field types here
POST {{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": -1,
"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.
POST {{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": -1,
"fieldId": 9569
},
{
"formatType": "jpg",
"contentType": "image/jpg",
"name": "Headshot2.jpg",
"entryId": -1,
"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.
POST {{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": -1,
"fieldId": 9569
}
]
}
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="attachment"; filename="Headshot.jpg"
Content-Type: image/jpg
< ./1.jpg
------WebKitFormBoundary7MA4YWxkTrZu0gW--
Response
RowIds in the response are the EntryIds for successful entries. EntryIds are kept as the invalid entryIds provided in the request to allow for filtering on the EntryIds if you would like to add a post processor.
HTTP/1.1 200 OK
[
{
"entryId": -1,
"fieldId": 2300,
"rowId": 3045615,
"isNoData": false,
"value": "Created Via API"
},
{
"entryId": -1,
"fieldId": 2227,
"rowId": 3045615,
"isNoData": false,
"value": "Second Field"
}
]
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. Do not split an Entry across batches. The new Entry Id is only valid for the batch. Splitting a entry across batches will result in new entries with partially filled fields. Its best to create 2 functions, BatchByEntryId and Create.
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> ChunkProcessBulkDataCreateRequestsAsync(this IntappAPIClient intappClient,
IEnumerable<DataRequestBase> pushRequests,
int entryListId,
bool retryFailedRequests = true)
{
var dcPushes = pushRequests.ToList();
var schema = await intappClient.ProcessCreateRequestAsync(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.ProcessCreateRequestAsync(withoutErrors, entryListId);
}
}
return schema;
}