Merges one or more secondary records into a primary record.
The primary record will be updated with the values from provided fields, an any attachments present in the secondary records will be copied to the primary record.
All references to secondary records will be updated, and finally the secondary records will be deleted.
Starting the job
This operation is a long-running batch job. You must first submit a request to start the job.
POST https://www.activityinfo.org/resources/jobs
Request body
object | |||
type | string | The type of the job to start. Must be "mergeRecords" |
required |
descriptor | object | required | |
databaseId | string | The id of the database containing the records to merge. | required |
formId | string | The id of the form containing the records to merge. | required |
primaryRecordId | string | The id of the primary record. This record is retained. | required |
secondaryRecordIds | array[string] | The ids of one or more secondary records. These records will be deleted, and all references to these records will be updated to the primary record id. | required |
fields | object | Updates to the primary record's field values. | required |
Getting the job status
The result of this first call provides a job id that you can use to poll for status:
GET https://www.activityinfo.org/resources/jobs/{jobId}
curl -X GET https://www.activityinfo.org/resources/jobs/ahBlfmFjdGl2aXR5aW5mb2V1chALEgNKb2IYgICAzd390wkM \
-u anything:APITOKEN \
-H 'Content-type: application/json' \
--data-binary @- << EOF
{
"id": "ahBlfmFjdGl2aXR5aW5mb2V1chALEgNKb2IYgICAzd390wkM",
"state": "STARTED"
}
EOF
Successful result
When the job state transitions to "COMPLETED"
, the status object will include the result:
object | |||
id | string | The id of the job | required |
state | string | "COMPLETED" |
required |
result | object | required | |
filename | string | The filename of the export. | required |
downloadUrl | string | The URL that can be used to download the result. | required |