Stream records as JSON documents to insert, update or delete a dataset's records.
Modifying a dataset's records allows you to create, update, or delete records. A CREATE
action can overwrite an existing record or create a new one, while a DELETE
action will remove the record from the dataset. The POST body comprises newline-delimited JSON documents, one document per update command, as follows.
{"action": "CREATE","recordId": "101","record": {"name":"John","email":["[email protected]","[email protected]"]}}
{"action": "CREATE","recordId": "102","record": {"name":"Jane","email":["[email protected]","[email protected]"]}}
{"action": "DELETE","recordId": "102"}
The fields in the JSON are as follows:
Field | Description |
---|---|
action | The action being requested.CREATE or DELETE . |
recordId | The ID of the record. |
record | Optional. The information the new record will contain upon creation. Fields in the record must exist in the schema of the dataset they are being added to. If fields are not in the schema, they will be ignored. |
Newline delimited JSON documents
The POST body comprises newline-delimited JSON documents. For convenience, the newline delimitation is not required, since the API uses the JSON document-end to delimit the stream.
Note however that exporting a dataset's records as JSON does indeed require newline delimitation (see Stream a Dataset's Records).
Response Fields
A successful command will return a JSON of metadata describing the action.
Field | Description |
---|---|
numCommandsProcessed | The number of commands successfully processed. |
allCommandsSucceeded | Whether all the commands were successful. true or false . |
validationErrors | A list of any validation errors that were returned for failed commands. Will only exist if allCommandSucceeded is false . |