commercetools icon

commercetools

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

Actions671

Discount Code → Check if DiscountCode exists by Key

AI-generated

Summary

Check if a Discount Code exists in the commercetools project by its unique key using a HEAD request to the commercetools API.

Inputs

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

Output shape

a JSON object with properties 'exists' (boolean), 'statusCode' (number), and 'url' (string) indicating the existence and HTTP status code of the request.

Returns exists=true with statusCode=200 if the Discount Code exists; returns exists=false with statusCode=404 if not found. Throws an error for other HTTP statuses.

Examples

Example 1: Check existence of Discount Code with key 'summer-sale'

Set resource to 'Discount Code', operation to 'Check if DiscountCode exists by Key', and Discount Code Key to 'summer-sale'.

Links

Discussion