Publishing audit log API

The publishing audit log API lets you track all the publishing operations in your Sitecore Content Hub environment (for example, updating or deleting an entity, modifying the schema, and so on). Each operation has two audit records: one when it starts and one when it succeeds or fails.

Base URL

The base URL of the publishing audit log API is:

RequestResponseshell
https://<domain name>/api/publishaudit/

Authentication

To access the publishing audit log API, you need an authentication token. Only superusers can generate tokens.

Methods

The publishing audit log API is for retrieving information, so it supports the GET method only.

Endpoints

The publishing audit log API has the following endpoints.

EndpointDescription
history/<tenant name>Returns a general audit log of all publishing operations, sorted by timestamp in descending order. The tenant name parameter is case-insensitive.
entityhistory/<tenant name>/<entity identifier>Returns the publishing operations related to a specific entity by entity identifier. Results are sorted by timestamp in descending order.
entityhistory/<tenant name>/id/<entity id>Returns the publishing operations related to a specific entity by entity id, sorted by timestamp in descending order.
entitypublishstatus/<tenant name>/<entity identifier>Returns the entity publishing status of a specific entity.
schemahistory/<tenant name>Returns all the publishing operations related to your schema, by timestamp in descending order.
inprogresscount/<tenant name>Returns the number of publishing operations that are still in progress.
entitiesByLastOperationStatus/<tenant name>/<operation status>

Returns all entities with a specific publishing status. The valid operation statuses are: InProgress, Success, Failure, and Cancelled.

NOTE

This endpoint is primarily meant for retrieving failed or in-progress operations. Querying for 'success' status can return a lot of results, which might affect performance or cause the request to fail.

performance/snapshot/<tenant name>Returns a performance snapshot. Use the startDate and endDate optional parameters to specify a datetime range. If not specified, dates will be skipped and time will default to the past 15 minutes.
performance/queuesReturns a list of all queues with their current states.

Optional query parameters

When writing queries to api/publishaudit/history, api/publishaudit/entityhistory, and api/publishaudit/schemahistory, you can include the following optional parameters:

ParameterTypeDescription
startDatedatetimeThe beginning of a datetime range for the search (in UTC). If this isn't specified, the query will return all available audit entries.
endDatedatetimeThe end of a datetime range for the search (in UTC). If this isn't specified, the query will return all available audit entries.
searchAfterstringThe point from where to start the next search, based on the searchAfter property value returned from a previous query. If you have multiple values, separate them with commas.
takeintegerThe number of items to return in a single request. Default value: 10.
fullTextstringThe term to be used in full-text searches. If this parameter is given a value, the request will only return audit entries whose fields contain that value.

General audit log example queries

The following sample query uses the history/<tenant name> endpoint to fetch a general audit log of all publishing operations.

Query:

RequestResponsehttp
GET https://<hostname>/api/publishAudit/history/CaaS

Response:

RequestResponseshell
{
    "items": [
        {...},
        {...},
        ...
    ],
    "total": 10000,
    "searchAfter": "1692293242818,129c39ab-6e3a-4eb2-bb8e-84a2e43e4b32"
}
Note

The response uses scrolling. The total property indicates the count of items returned by the query, capped at 10,000.

In the following sample, the initial query is refined using the take and searchAfter optional parameters. The take parameter is set to 3, to return the 3 results starting from the points specified in the searchAfter parameter.

Query:

RequestResponsehttp
GET https://<hostname>/api/publishAudit/history/CaaS?searchAfter=1692293242843,7483c2f8-653b-4f77-9ee4-9bed00a23845&take=20

Response:

RequestResponseshell
{
  "items": [
    {
      "delivery_messsage_id": "3667f906-bb0c-4d2e-8cee-45eb75763371",
      "tenant": "CaaS",
      "operation": "EntityUpdateACK",
      "operation_status": "Success",
      "detailed_description": null,
      "publish_status": "Published",
      "is_latest_publish_status": true,
      "user_name": "Superuser",
      "operation_attributes": "SkipUserNotification",
      "skip_notification": true,
      "id": "78705504-05d9-4bfe-900d-836482ae3a03",
      "event_type": null,
      "severity": null,
      "target_id": 9788,
      "target_identifier": "M.ContentType.WhitePaper",
      "timestamp": "2023-08-17T17:27:22.8337201Z",
      "@timestamp": "2023-08-17T17:27:22.8337201Z",
      "user_id": 805
    },
    {
      "delivery_messsage_id": "a9e5997f-e484-4eaa-a9a7-748e9f2ba712",
      "tenant": "CaaS",
      "operation": "EntityUpdateACK",
      "operation_status": "Success",
      "detailed_description": null,
      "publish_status": "Published",
      "is_latest_publish_status": true,
      "user_name": "Superuser",
      "operation_attributes": "SkipUserNotification",
      "skip_notification": true,
      "id": "d7dbfe7d-8375-47fd-8ede-1a7e2796f205",
      "event_type": null,
      "severity": null,
      "target_id": 9787,
      "target_identifier": "M.ContentType.SocialMediaMessage",
      "timestamp": "2023-08-17T17:27:22.8263286Z",
      "@timestamp": "2023-08-17T17:27:22.8263286Z",
      "user_id": 805
    },
    {
      "delivery_messsage_id": "20628934-e62b-4471-88c5-468d930e4bd6",
      "tenant": "CaaS",
      "operation": "EntityUpdateACK",
      "operation_status": "Success",
      "detailed_description": null,
      "publish_status": "Published",
      "is_latest_publish_status": true,
      "user_name": "Superuser",
      "operation_attributes": "SkipUserNotification",
      "skip_notification": true,
      "id": "129c39ab-6e3a-4eb2-bb8e-84a2e43e4b32",
      "event_type": null,
      "severity": null,
      "target_id": 9791,
      "target_identifier": "M.ContentType.Email",
      "timestamp": "2023-08-17T17:27:22.8186412Z",
      "@timestamp": "2023-08-17T17:27:22.8186412Z",
      "user_id": 805
    }
  ],
  "total_items": 873,
  "searchAfter": "1692293242818,129c39ab-6e3a-4eb2-bb8e-84a2e43e4b32"
}

Do you have some feedback for us?

If you have suggestions for improving this article,