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 ID

AI-generated

Summary

Check whether a Discount Code exists in commercetools by its ID using a HEAD request.

Inputs

  • Discount Code ID (required) — The ID of the Discount Code to check for existence.

Output shape

a JSON object with properties: 'exists' (boolean) indicating if the Discount Code exists, 'statusCode' (number) indicating the HTTP response status, and 'url' (string) of the request made.

Returns no detailed Discount Code data, only existence confirmation. If the Discount Code is not found, 'exists' is false and 'statusCode' is 404. Other HTTP errors will throw an error and halt execution unless continueOnFail is enabled.

Examples

Example 1: Check if Discount Code exists

Provide the Discount Code ID to verify its existence in the commercetools project. The node sends a HEAD request to the Discount Code endpoint and returns whether it exists.

Links

Discussion