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": "66bfb4bb9ab4e3d6eb73480b",
    "created": "2024-08-16 20:21:15",
    "details": null,
    "document_types": [
        "AccountContact"
    ],
    "documents": [
        "66bfb4bb9ab4e3d6eb73480a"
    ],
    "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": 3153,
    "items": [
        {
            "_id": "66bfb4bb9ab4e3d6eb73480b",
            "document_types": [
                "AccountContact"
            ],
            "type": "ADDED"
        },
        {
            "_id": "66bfb4bb9ab4e3d6eb73480d",
            "document_types": [
                "APIKey"
            ],
            "type": "ADDED"
        },
        {
            "_id": "66bfb4bb9ab4e3d6eb73480f",
            "document_types": [
                "CustomTemplate"
            ],
            "type": "ADDED"
        },
        {
            "_id": "66bfb4bb9ab4e3d6eb734811",
            "document_types": [
                "NominalCode"
            ],
            "type": "ADDED"
        },
        {
            "_id": "66bfb4bb9ab4e3d6eb734813",
            "document_types": [
                "NominalCode"
            ],
            "type": "ADDED"
        },
        {
            "_id": "66bfb4bb9ab4e3d6eb734815",
            "document_types": [
                "NominalCode"
            ],
            "type": "ADDED"
        },
        {
            "_id": "66bfb4bb9ab4e3d6eb734817",
            "document_types": [
                "NominalCode"
            ],
            "type": "ADDED"
        },
        {
            "_id": "66bfb4bb9ab4e3d6eb734819",
            "document_types": [
                "TaxRate"
            ],
            "type": "ADDED"
        },
        {
            "_id": "66bfb4bb9ab4e3d6eb73481b",
            "document_types": [
                "TaxRate"
            ],
            "type": "ADDED"
        },
        {
            "_id": "66bfb4bb9ab4e3d6eb73481d",
            "document_types": [
                "TaxRate"
            ],
            "type": "ADDED"
        }
    ],
    "page": 1,
    "page_count": 316,
    "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": "66bfb4bb9ab4e3d6eb73480b",
    "created": "2024-08-16 20:21:15",
    "details": null,
    "document_types": [
        "AccountContact"
    ],
    "documents": [
        "66bfb4bb9ab4e3d6eb73480a"
    ],
    "type": "ADDED",
    "user": "CareHQ demo builder"
}