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:

RequestResponse
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.

Endpoint

Description

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.

entitystatus/<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/queues

Returns 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:

Parameter

Type

Description

startDate

datetime

The beginning of a datetime range for the search (in UTC). If this isn't specified, the query will return all available audit entries.

endDate

datetime

The end of a datetime range for the search (in UTC). If this isn't specified, the query will return all available audit entries.

searchAfter

string

The 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.

take

integer

The number of items to return in a single request. Default value: 10.

fullText

string

The 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:

RequestResponse
GET https://<HOSTNAME>/api/publishAudit/history/CaaS

Response:

RequestResponse
{
  "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:

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

Response:

RequestResponse
{
 "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,