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": "662edc59835c6a1ad9675beb",
    "created": "2024-04-28 23:31:37",
    "details": null,
    "document_types": [
        "AccountContact"
    ],
    "documents": [
        "662edc59835c6a1ad9675bea"
    ],
    "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": 3231,
    "items": [
        {
            "_id": "662edc59835c6a1ad9675beb",
            "document_types": [
                "AccountContact"
            ],
            "type": "ADDED"
        },
        {
            "_id": "662edc59835c6a1ad9675bed",
            "document_types": [
                "APIKey"
            ],
            "type": "ADDED"
        },
        {
            "_id": "662edc59835c6a1ad9675bef",
            "document_types": [
                "CustomTemplate"
            ],
            "type": "ADDED"
        },
        {
            "_id": "662edc59835c6a1ad9675bf1",
            "document_types": [
                "Group"
            ],
            "type": "ADDED"
        },
        {
            "_id": "662edc59835c6a1ad9675bf3",
            "document_types": [
                "Group"
            ],
            "type": "ADDED"
        },
        {
            "_id": "662edc59835c6a1ad9675bf5",
            "document_types": [
                "Group"
            ],
            "type": "ADDED"
        },
        {
            "_id": "662edc59835c6a1ad9675bf7",
            "document_types": [
                "Group"
            ],
            "type": "ADDED"
        },
        {
            "_id": "662edc59835c6a1ad9675bf9",
            "document_types": [
                "Group"
            ],
            "type": "ADDED"
        },
        {
            "_id": "662edc59835c6a1ad9675bfb",
            "document_types": [
                "Group"
            ],
            "type": "ADDED"
        },
        {
            "_id": "662edc59835c6a1ad9675bfd",
            "document_types": [
                "Group"
            ],
            "type": "ADDED"
        }
    ],
    "page": 1,
    "page_count": 324,
    "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": "662edc59835c6a1ad9675beb",
    "created": "2024-04-28 23:31:37",
    "details": null,
    "document_types": [
        "AccountContact"
    ],
    "documents": [
        "662edc59835c6a1ad9675bea"
    ],
    "type": "ADDED",
    "user": "CareHQ demo builder"
}