commercetools icon

commercetools

Interact with the commercetools API. Operations are auto-generated from the official Postman collection.

Actions671

Category → Check if Category exists by Key

AI-generated

Summary

Check the existence of a commercetools Category by its unique key using a HEAD request.

Inputs

  • Category Key (required) — The unique key of the Category to check for existence.

Output shape

a JSON object with 'exists' (boolean), 'statusCode' (number), and 'url' (string) fields confirming if the Category with the specified key exists.

Internally performs an HTTP HEAD request; returns 'exists: true' if the category is found, or 'exists: false' if not (HTTP 404). Throws an error for other HTTP errors.

Examples

Example 1: Category with key 'summer-sale' exists

Category Key = 'summer-sale' produces { exists: true, statusCode: 200, url: '' }

Example 2: Category with key 'nonexistent' does not exist

Category Key = 'nonexistent' produces { exists: false, statusCode: 404, url: '' }

Links

Discussion