Developer docs · Problems

Collection constraint

HTTP 422 · https://impartire.com/problems/collection-constraint

What it means

The collection does not accept this asset: its type is not in allowed_type_ids, it carries none of allowed_category_ids, or the collection is published and the asset is not. errors[].path names the rule; GET the collection to see its constraints.

What to do

Read errors[].path for the rule: allowed_type_ids (add an asset of an allowed type, or widen the list with PATCH /api/v1/collections/{id}), allowed_category_ids (assign the asset one of the categories in the app), or published (the collection is published; publish the asset first, in the app).

Example

Sent as application/problem+json with status 422. detail varies with the request; branch on type.

{
  "type": "https://impartire.com/problems/collection-constraint",
  "title": "Collection constraint",
  "status": 422,
  "detail": "This asset's type is not allowed in this collection. GET /api/v1/collections/5a7c1e2d-3b4f-4a6e-9d8c-7b6a5f4e3d2c shows its allowed_type_ids and allowed_category_ids.",
  "instance": "/api/v1/collections/5a7c1e2d-3b4f-4a6e-9d8c-7b6a5f4e3d2c/items",
  "request_id": "01JB8Z5W6Q4N3X2V1T0S9R8P7M",
  "errors": [
    {
      "path": "allowed_type_ids",
      "message": "This asset's type is not allowed in this collection"
    }
  ]
}