Record Revision
As Records in Tape change over time, it is important to understand what changes were made, by whom and when. Revisions can be retrieved via the API.
Revisions concept
Every record in Tape has a revision
number property, that starts with 0
upon creation and is increased with each change made to the Record.
Record revisions will include the author of the revision as created_by
, the date and time of the revision created_on
and the revision number.
Retrieve Revisions for a Record
The following example fetches the revisions of record with ID 1
, that was created and updated once by the user Dan Jacob
with ID 600
:
Query param | Type | Description |
---|---|---|
include_deleted | boolean | Include records that are deleted but still accessible via a trash (default: false ) |
curl -X GET https://api.tapeapp.com/v1/record/1/revision \
-u user_key_replace_with_your_api_key:
{
"total": 2,
"revisions": [
{
"created_by": {
"user_id": 600,
"name": "Dan Jacob",
"type": "user",
"image": null
},
"created_on": "2022-03-16 14:25:00",
"type": "creation",
"revision": 0
},
{
"created_by": {
"user_id": 600,
"name": "Dan Jacob",
"type": "user",
"image": null
},
"created_on": "2022-03-16 14:30:00",
"type": "update",
"revision": 1
}
]
}
Note
Note that Revisions do not contain the actual changes made, but only the meta data. Use the endpoint described in the next section to fetch individual revision changes.
Retrieve Revision delta
In order to understand how a record changed over time, the Tape-API provides consumers with the concept of Revision Deltas. Revision deltas will include a from
and to
property, describing the transition of individual fields from one value (or no value) to another (or none). These properties follow the same form as record field values
property, check the field value section for more details.
A single record revision may include deltas for multiple fields, if the changes were made at the same time by the same entity.
The following example fetches the revision delta of revision number 1
of record with ID 1
to its previous revision number 0
to understand the changes made from the previous example. One may now see that a single text field with external_id notes
was updated from no value to the value Some important notes
.
curl -X GET https://api.tapeapp.com/v1/record/1/revision/previous/1 \
-u user_key_replace_with_your_api_key:
{
"total": 2,
"revision_deltas": [
{
"from": [],
"external_id": "notes",
"field_id": 2000,
"label": "Notes",
"to": [
{
"value": "Some important notes"
}
],
"type": "contact",
"config": {
"description": null,
"required": false,
"label": "Notes"
}
}
]
}