Beta - Bulk delete items.

This is a Beta API it is subject to change. Use the /changes/delete endpoint to delete multiple items. Currently, only assets and content are supported.

Requests

Specify the items that you want to delete in the request body.

  {
    "ids": [
      {
        "id": "579c2232-7398-4c8b-921d-3932bfc45d19",
        "classification": "content"
      },
      {
        "id": "448e8d63-ed15-4d59-85e5-53908a84ca93",
        "classification": "asset"
      }
    ]
  }

Alternatively you can also make requests with the content hub unique ID. The unique ID is the items classification and the ID combined to create an ID that is unique across all content hub items.

  {
    "ids": [
      { "id": "content:579c2232-7398-4c8b-921d-3932bfc45d19" },
      { "id": "asset:448e8d63-ed15-4d59-85e5-53908a84ca93" }
    ]
  }

Responses

When the request succeeds for all items, then the status field will have the value success. If some items succeed, but others fail, the status field will have the value partial. If all items fail, the status field will have the value failure.

There are a number of arrays which are returned when items fail to delete. These help categorize the errors which you may want to action in different ways. In the case where all items succeed, only the successful array will be returned.

  • successful - Items that were successfully deleted.
  • skipped - Items which would have been deleted but were not due to other failures. Once the other failures are resolved these items should be successfully deleted.
  • userError - Items that cannot be deleted because they require must be either removed from the request or require some further user action before they can succeed. These include the following errors:
    • Insufficient Permissions - Drafts may be deleted by anyone, but non-draft items may ony be deleted by a manager or administrator.
    • Missing Dependencies - These items have other items depending on them and cannot be deleted. To delete these items, either the depency on these items must be removed, or the other items must also be deleted.
  • missing - Items that have a dependency on one or more of the items requested for deletion.
  • genericErrors - Items that the system failed to delete.

The messages object contains information on the specific failure for each individual failing item.

Examples

Success

Where a request to delete a content and an asset are successful.

Request

  {
    "ids": [
      { "id": "content:a" },
      { "id": "asset:b" }
    ]
  }

Response

  {
    "status": "success"
    "successful": ["content:a", "content:b"]
  }

Partial Failure

In the example that is shown, the goal was to delete items with IDs a and b. Items cannot be deleted if another item has dependency to it. In this case content b is referenced by asset c. The content item a is marked as skipped, where if the issue with b is resolved then item a would then be successfully deleted. Content b is marked as a user error and the dependant asset c is marked as missing.

Alternatively, you can use the authoring reference API to check and obtain the connected items before you perform the bulk delete request.

Request

  {
    "ids": [
      { "id": "content:a" },
      { "id": "content:b" }
    ]
  }

Response

  {
    "status": "partial"
    "successful": []
    "skipped": ["content:a"],
    "genericErrors": [],
    "userErrors": ["content:b"],
    "missing": ["asset:c"],
    "messages": {
      "content:b": {
        "uid": "content:b",
        "id": "b",
        "classification": "content",
        "key": "missing.dependencies.details.20201",
        "code": 20201,
        "parameters": {
          "missing": [
            {
              "uid": "asset:c",
              "id": "c",
              "classification": "asset",
              "name": "Banner Image"
            }
          ]
        }
      }
    }
  }


User roles: admin, manager, editor

Language
Click Try It! to start a request and see the response here!