get https://{subdomain}.myshoplaza.com/openapi/2022-01/discount_codes
Retrieves a list of discount code.
Requires
price_rules
access scope. More access scope
The Discount Code List API retrieves a list of all discount codes.
This API is especially useful for:
- Fetching paginated lists of discount codes for review.
- Retrieving details and links for further management of discount codes.
- Validating and auditing discount code data for use.
Request Parameters
Public Request Parameters
Query Parameters
Field | Type | Required | Description | Example |
---|---|---|---|---|
limit | int32 | No | Number of records per page. Maximum: 250. | 50 |
page | int32 | No | Page number to retrieve. | 1 |
need_detail_url | boolean | No | If true , returns detail URLs in the response. | true |
Response Explanation
Public Response Parameters
Successful Response
Field | Type | Example | Description |
---|---|---|---|
page | int32 | 1 | Current page number. |
limit | int32 | 20 | Number of records per page. |
total | string | "1" | Total number of discount codes available. |
data | array[object] | See below. | List of discount codes. |
data[].allocation_limit | string | "1" | Allocation limit for the discount code. |
data[].allocation_limit_amount | string | "0.0000" | Maximum allocation amount for the discount code. |
data[].allocation_method | string | "" | Method of allocation for the discount code. |
data[].app_id | string | "" | App ID associated with the discount code. |
data[].code | string | "123234" | Unique code for the discount. |
data[].customer_selection | string | "all" | Type of customer selection for the discount. |
data[].detail_url | string | "tzt.myshoplaza.com/promotions/coupon/1783371b-76c1-41ab-a09c-531ff54425fc" | Detail URL for managing the discount. |
data[].discount_type | string | "percentage" | Type of discount, e.g., fixed amount or percentage. |
data[].ends_at | string | "-1" | End timestamp for the discount code. |
data[].entitled_filter_ids | array[string] | [] | List of entitled filter IDs. |
data[].entitled_filter_list | array[string] | [] | List of entitled filters. |
data[].entitled_product_ids | array[string] | [] | List of entitled product IDs. |
data[].id | string | "1783371b-76c1-41ab-a09c-531ff54425fc" | Unique identifier for the discount code. |
data[].is_admin_show | string | "1" | Whether the code is displayed for admins. |
data[].once_per_customer | string | "1" | Whether the discount can be used once per customer. |
data[].prerequisite | string | "0" | Indicates if there are prerequisites for the discount. |
data[].prerequisite_customer_ids | array[string] | [] | List of prerequisite customer IDs. |
data[].prerequisite_customer_segment_ids | array[string] | [] | List of prerequisite customer segment IDs. |
data[].product_num | null | null | Number of products associated with the discount. |
data[].progress | string | "ongoing" | Current progress status of the discount. |
data[].sort | string | "{\"by\":\"title\",\"direction\":\"asc\"}" | Sort order of the discount codes. |
data[].starts_at | string | "1682652119" | Start timestamp for the discount code. |
data[].status | string | "1" | Current status of the discount code. |
data[].target_price_type | string | "combined_price" | Target price type for the discount, e.g., combined price. |
data[].target_selection | string | "all" | Target selection type for the discount. |
data[].target_type | string | "line_item" | Target type for the discount, e.g., line item. |
data[].times_used | string | "0" | Number of times the discount code has been used. |
data[].title | string | "tzt" | Title of the discount. |
data[].usage_limit | string | "1" | Usage limit for the discount code. |
data[].use_with_other | string | "0" | Whether the discount can be used with other discounts. |
data[].using_state | string | "normal" | Current usage state of the discount code. |
data[].value | float | 1 | Discount value. |
data[].value_type | string | "percentage" | Type of value, e.g., fixed amount or percentage. |
data[].variant_product_ids | array[string] | [] | List of variant product IDs. |
Error Response
Error responses in the API can be represented using two different fields: errors
and error
. Both fields provide details about issues encountered during request processing. Below is an explanation of the fields with their respective examples and descriptions.
Field | Type | Example | Description |
---|---|---|---|
errors | Array | [ "invalid line_item id"] | A list of errors encountered during the request processing. |
Field | Type | Example | Description |
---|---|---|---|
error | String | "store is not active" | Indicates an error encountered during the process |
Error Detail
Status Code | Message | Possible Reason | Example Response |
---|---|---|---|
400 | Bad Request | Invalid input format or request structure (e.g., missing required fields or incorrect data types). | Bad Request |
Unauthorized | The request is missing valid authentication credentials or the credentials provided are invalid. | Unauthorized |