TrackRecordPro API Documentation TrackRecordPro

Updating and Creating Records

To update or create records in the TrackRecordPro system via the API, you must send your data to be updated as a JSON encoded object.

When you send POST HTTP requests, this is interpreted to mean an UPDATE of the data which means the system expects only one object, and all the matching records will be updated to reflect the given data. For example the following would update the first name, last name and email address of an existing user if POSTed to the users endpoint:

{"first_name":"Bob","last_name":"Bobbington","email":"bobs@company.com"}

Alternatively, when you send a PUT request this is interpreted to mean INSERT of data, in which case you can either specify one object:

{"first_name":"Michael","last_name":"Myers","email":"axes@hatchets.com"}

or, you may specify multiple objects to create as a batch, contained in an array:

[
    {"first_name":"Michael","last_name":"Myers","email":"axes@hatchets.com"},
    {"first_name":"Fred","last_name":"Kruger","email":"sharp@fingernails.com"}
]

Note that if you request addition of a batch of objects, this is created atomically as a transaction; if validation of one object fails, the entire batch is rejected.

In the event of a successful update or insert, you will receive a message indicating the number of rows inserted or updated:

{
    "request": {
        "url": "\/3.0\/users\/id=2",
        "endpoint": "users",
        "requested_version": "3.0",
        "api_version": 3,
        "request_method": "Post",
        "timestamp": 1507622071,
        "session": null
    },
    "response": {
        "records_updated": 1,
        "records_found": 1
    }
}

In the event of an error, you will receive a standard error response.