Change log entries

Each entry in the change log represents a change to data within the CareHQ application and provides details on what changed, when and who made the change.

The change log entry object

Attributes

  • _id
    string

    A unique Id for the billing contract.

  • created
    string

    The date/time the change was logged.

  • details
    hash

    A dictionary containing details of the change.

    • details.additions
      hash

      A dictionary of field values added in the change.

    • details.note
      string

      A note in the change log.

    • details.deletions
      hash

      A dictionary of values removed in the change.

    • details.updates
      hash

      A dictionary of values updated in the change.

  • document_types
    list of strings

    A list of document types the change relates to. Note that the order of the document types field relates to the order of the documents field.

  • documents
    list of strings

    A list of document Ids the change relates to.

  • type
    string

    The type of change made; ADDED, DELETED, NOTE, UPDATED.

  • user
    string

    The Id of the user the change was made by. Note that if the change was made by the CareHQ application and not a directly by a user then user will be set as "CareHQ app".

The change log entry object
{
    "_id": "6724fbc74f73a2cebf6376fb",
    "created": "2024-11-01 16:03:19",
    "details": null,
    "document_types": [
        "AccountContact"
    ],
    "documents": [
        "6724fbc74f73a2cebf6376fa"
    ],
    "type": "ADDED",
    "user": "CareHQ demo builder"
}

List all change log entries

Return a list of change log entries.

Parameters

  • attributes
    optional
    default ['_id']

    A list of attributes to include for fetched objects.

  • filters-created_after
    optional

    A filter that accepts a date/time and filters the items returned to those created after the date/time.

  • filters-created_before
    optional

    A filter that accepts a date/time and filters the items returned to those created before the date/time.

  • filters-ids
    optional

    A filter that accepts a list of Ids and filters the items returned to those with an Id in the list.

  • page
    optional
    default 1

    The page number to fetch.

  • per_page
    optional
    default 10

    The number of items to return per page.

  • sort_by
    optional
    default _id

    A list of fields the returned items can be sorted by. Fields prefixed with minus (-) sign are sorted in descending order.

    • _id
    • created

Response

Returns a page of change log entries.

GET
/v1/change-log-entries
var changeLogEntries = apiClient.Request(
    HttpMethod.Get,
    "change-log-entries",
    new MultiValueDict()
        .Add("attributes", "type", "document_types", "document_type")
        .Add("sort_by", "created")
);
<?php

$change_log_entries = $api_client->request(
    'GET',
    'change-log-entries',
    [
        'attributes'=>['type', 'document_types', 'document_type'],
        'sort_by'=>'created'
    ]
);
change_log_entries = api_client(
    'GET',
    'change-log-entries',
    params={
        'attributes': ['type', 'document_types', 'document_type'],
        'sort_by': 'created'
    }
)
change_log_entries = api_client.request(
    'GET',
    'change-log-entries',
    params: {
        'attributes' => ['type', 'document_types', 'document_type'],
        'sort_by' => 'created'
    }
)
Response
{
    "item_count": 3173,
    "items": [
        {
            "_id": "6724fbc74f73a2cebf6376fb",
            "document_types": [
                "AccountContact"
            ],
            "type": "ADDED"
        },
        {
            "_id": "6724fbc74f73a2cebf6376fd",
            "document_types": [
                "APIKey"
            ],
            "type": "ADDED"
        },
        {
            "_id": "6724fbc74f73a2cebf6376ff",
            "document_types": [
                "CustomTemplate"
            ],
            "type": "ADDED"
        },
        {
            "_id": "6724fbc74f73a2cebf637701",
            "document_types": [
                "NominalCode"
            ],
            "type": "ADDED"
        },
        {
            "_id": "6724fbc74f73a2cebf637703",
            "document_types": [
                "NominalCode"
            ],
            "type": "ADDED"
        },
        {
            "_id": "6724fbc74f73a2cebf637705",
            "document_types": [
                "NominalCode"
            ],
            "type": "ADDED"
        },
        {
            "_id": "6724fbc74f73a2cebf637707",
            "document_types": [
                "NominalCode"
            ],
            "type": "ADDED"
        },
        {
            "_id": "6724fbc74f73a2cebf637709",
            "document_types": [
                "TaxRate"
            ],
            "type": "ADDED"
        },
        {
            "_id": "6724fbc74f73a2cebf63770b",
            "document_types": [
                "TaxRate"
            ],
            "type": "ADDED"
        },
        {
            "_id": "6724fbc74f73a2cebf63770d",
            "document_types": [
                "TaxRate"
            ],
            "type": "ADDED"
        }
    ],
    "page": 1,
    "page_count": 318,
    "per_page": 10
}

Retrieve a message

Retrieve a message object.

Response

Returns a change log entry object.

GET
/v1/change-log-entries/<change_log_entry_id>
var changeLogEntry = apiClient.Request(
    HttpMethod.Get,
    $"change-log-entries/{changeLogEntryId}"
)
<?php

$change_log_entry = $api_client->request(
    'GET',
    'change-log-entries/' . $change_log_entry_id
);
change_log_entry = api_client(
    'GET',
    f'change-log-entries/{change_log_entry_id}'
)
change_log_entry = api_client.request(
    'GET',
    "change-log-entries/#{change_log_entry_id}"
)
Response
{
    "_id": "6724fbc74f73a2cebf6376fb",
    "created": "2024-11-01 16:03:19",
    "details": null,
    "document_types": [
        "AccountContact"
    ],
    "documents": [
        "6724fbc74f73a2cebf6376fa"
    ],
    "type": "ADDED",
    "user": "CareHQ demo builder"
}