Coupons

Coupons

Creates a new coupon record that does not already exist.

This method will auto-generate an ID and create a new coupon. If an ID is specified for the coupon, an error will be thrown.

Request
Security:
path Parameters
tenantId
required
string

The id of the tenant being accessed.

Request Body schema: application/json

The coupon that you would like to be saved.

id
required
string (ID) /^[\w|-]+$/

The unique, string identifier of this coupon

name
required
string (Name)

The name of the coupon

code_generation_html
string (Code Generation Html)

HTML you can add into HTML generation for the code

expiration_date
string <date-time> (Expiration Date)

The date/time that this coupon expires

maximum_discount
number <float> (Maximum Discount)

The optional maximum discount that this coupon can yield, irrespective of its configuration

applies_to_miscellaneous_products
boolean (Applies To Miscellaneous Products)

Whether or not this coupon applies to misc products

limit_total_uses
integer (Limit Total Uses)

The maximum number of times this coupon can be used

limit_uses_per_customer
integer (Limit Uses Per Customer)

The maximum number of times this coupon can be used by a particular customer

is_active
required
boolean (Is Active)

Whether this coupon is enabled

type
required
string (Type)

The type of discount to apply

Enum: "fixed amount off order" "fixed amount off each item" "percentage off each item" "fixed amount off shipping" "free shipping"
amount
required
number <float> (Amount)

Amount of the discount

minimum_purchase
number <double> (Minimum Purchase)

Minimum a customer must purchase to qualify for coupon

limit_to_product_categories
Array of strings (Limit To Product Categories)

Limit purchase to particular product categories

limit_to_products
Array of strings (Limit To Products)

Limit purchase to particular products

discount_product_id
required
string (Discount Product)

The product uses for the discount code when it is at the order level

Array of objects (Custom Field Values)
sys_deleted_by_id
string (Sys Deleted By)

The ID of the user that deleted (or last tried to delete) this object

sys_version
number <float> (Sys Version)

A number representing the version of this record in the database

sys_created_at
required
string <date-time> (Sys Created At)

The date/time that this record was created, expressed in ISO-8601 date format

sys_last_modified_at
required
string <date-time> (Sys Last Modified At)

The date/time that this record record was last modified, expressed in ISO-8601 date format

sys_created_by_id
required
string (Sys Created By)

The ID of the user that created this record

sys_last_modified_by_id
required
string (Sys Last Modified By)

The ID of the user that last modified this record

sys_external_id
string (Sys External)

The ID that a record has from an external system or data import

sys_locked
boolean (Sys Locked)

If set, this record is locked and cannot be changed via the API

sys_bulk_load_pk
string (Sys Bulk Load Pk)

If this record was loaded via bulk, the tenant and key of the bulk load process used as a partition key

sys_bulk_load_at
string (Sys Bulk Load At)

If this record was loaded via bulk, the timestamp when the record was processed

sys_bulk_load_id
string (Sys Bulk Load)

If this record was loaded via bulk, the ID of the bulk load process

sys_bulk_load_record_no
number <float> (Sys Bulk Load Record No)

If this record was loaded via bulk, the record number in the source file

sys_bulk_load_source_file
string (Sys Bulk Load Source File)

If this record was loaded via bulk, the source file

sys_last_bulk_data_operation_id
string (Sys Last Bulk Data Operation)

If this record was last touched by a bulk data operation, the ID of that operation

sys_last_bulk_data_operation_sys_version
string (Sys Last Bulk Data Operation Sys Version)

If this record was last touched by a bulk data operation, the sys_version at the time of that operation

sys_directive
string (Sys Directive)

Means for passing directive information into an object processing logic

sys_calculated_field_error
string (Sys Calculated Field Error)

The error associated with the calculated field

sys_snapshot_base_version
number <float> (Sys Snapshot Base Version)

The version to use as a base when creating a configuration snapshot; if not set, 1 is used. Helpful when creating a sandbox

sys_has_files_in_s3
boolean (Sys Has Files In S3)

If true, this record has files in S3. If false, it doesnt, so no need to hit S3 upon deletion

sys_configuration_snapshot_id
string (Sys Configuration Snapshot)

If a snapshot was restored/applies to this record, the ID of the snapshot

sys_last_security_context
object (Sys Last Security Context)

The security context of the last insert, modify, or delete performed on this item

Array of objects
Responses
200The coupon was saved successfully.
400The coupon you supplied was invalid.
401Unauthorized.
403Forbidden.
404The resource could not be found
409The coupon could not be saved because it refers to/depends on a non-existent object.
429Limit exceeded... unable to add coupon based on tenant limits.
500General server error.
post/coupons/{tenantId}
Request samples
application/json
{
  • "id": "string",
  • "name": "string",
  • "code_generation_html": "string",
  • "expiration_date": "2019-08-24T14:15:22Z",
  • "maximum_discount": 0,
  • "applies_to_miscellaneous_products": true,
  • "limit_total_uses": 0,
  • "limit_uses_per_customer": 0,
  • "is_active": true,
  • "type": "fixed amount off order",
  • "amount": 0,
  • "minimum_purchase": 0,
  • "limit_to_product_categories": [
    ],
  • "limit_to_products": [
    ],
  • "discount_product_id": "string",
  • "custom_field_values": [
    ],
  • "sys_deleted_by_id": "string",
  • "sys_version": 0,
  • "sys_created_at": "2019-08-24T14:15:22Z",
  • "sys_last_modified_at": "2019-08-24T14:15:22Z",
  • "sys_created_by_id": "string",
  • "sys_last_modified_by_id": "string",
  • "sys_external_id": "string",
  • "sys_locked": true,
  • "sys_bulk_load_pk": "string",
  • "sys_bulk_load_at": "string",
  • "sys_bulk_load_id": "string",
  • "sys_bulk_load_record_no": 0,
  • "sys_bulk_load_source_file": "string",
  • "sys_last_bulk_data_operation_id": "string",
  • "sys_last_bulk_data_operation_sys_version": "string",
  • "sys_directive": "string",
  • "sys_calculated_field_error": "string",
  • "sys_snapshot_base_version": 0,
  • "sys_has_files_in_s3": true,
  • "sys_configuration_snapshot_id": "string",
  • "sys_last_security_context": { },
  • "sys_calculated_field_errors": [
    ]
}
Response samples
application/json
{
  • "id": "string",
  • "name": "string",
  • "code_generation_html": "string",
  • "expiration_date": "2019-08-24T14:15:22Z",
  • "maximum_discount": 0,
  • "applies_to_miscellaneous_products": true,
  • "limit_total_uses": 0,
  • "limit_uses_per_customer": 0,
  • "is_active": true,
  • "type": "fixed amount off order",
  • "amount": 0,
  • "minimum_purchase": 0,
  • "limit_to_product_categories": [
    ],
  • "limit_to_products": [
    ],
  • "discount_product_id": "string",
  • "custom_field_values": [
    ],
  • "sys_deleted_by_id": "string",
  • "sys_version": 0,
  • "sys_created_at": "2019-08-24T14:15:22Z",
  • "sys_last_modified_at": "2019-08-24T14:15:22Z",
  • "sys_created_by_id": "string",
  • "sys_last_modified_by_id": "string",
  • "sys_external_id": "string",
  • "sys_locked": true,
  • "sys_bulk_load_pk": "string",
  • "sys_bulk_load_at": "string",
  • "sys_bulk_load_id": "string",
  • "sys_bulk_load_record_no": 0,
  • "sys_bulk_load_source_file": "string",
  • "sys_last_bulk_data_operation_id": "string",
  • "sys_last_bulk_data_operation_sys_version": "string",
  • "sys_directive": "string",
  • "sys_calculated_field_error": "string",
  • "sys_snapshot_base_version": 0,
  • "sys_has_files_in_s3": true,
  • "sys_configuration_snapshot_id": "string",
  • "sys_last_security_context": { },
  • "sys_calculated_field_errors": [
    ]
}

Gets all of the coupons in the system.

This method will scan all coupons and and return them to the caller.

Request
Security:
path Parameters
tenantId
required
string

The id of the tenant being accessed.

query Parameters
fields
string

The fields that you want to retrieve; if omitted, the entire object is returned.

exclusiveStartKey
string

The start key, if you're making a subsequent request

Responses
200The couponswere retrieved successfully.
400The request was invalid.
401Unauthorized.
403Forbidden.
404The resource could not be found
429Limit exceeded... unable to add contact role based on tenant limits.
500General server error.
get/coupons/{tenantId}
Request samples
curl -i -X GET \
  'https://commerce.api.756794052567.rhythmsoftware.com/coupons/:tenantId?fields=string&exclusiveStartKey=string' \
  -H 'Authorization: YOUR_API_KEY_HERE'
Response samples
application/json
[
  • {
    }
]

Returns a coupon from the system by its ID.

This method will look up a coupon by the specified ID and return it back.

Request
Security:
path Parameters
tenantId
required
string

The id of the tenant being accessed.

id
required
string

The ID of the coupon to return.

query Parameters
fields
string

The fields that you want to retrieve; if omitted, the entire object is returned.

consistentRead
string

Indicates the API should force a consistent read on the data source.

Responses
200The coupon was retrieved successfully.
400The request was not valid.
401Unauthorized.
403Forbidden.
404The coupon could not be found.
429Limit exceeded... unable to retrieve coupon based on tenant limits.
500General server error.
get/coupons/{tenantId}/{id}
Request samples
curl -i -X GET \
  'https://commerce.api.756794052567.rhythmsoftware.com/coupons/:tenantId/:id?fields=string&consistentRead=string' \
  -H 'Authorization: YOUR_API_KEY_HERE'
Response samples
application/json
{
  • "id": "string",
  • "name": "string",
  • "code_generation_html": "string",
  • "expiration_date": "2019-08-24T14:15:22Z",
  • "maximum_discount": 0,
  • "applies_to_miscellaneous_products": true,
  • "limit_total_uses": 0,
  • "limit_uses_per_customer": 0,
  • "is_active": true,
  • "type": "fixed amount off order",
  • "amount": 0,
  • "minimum_purchase": 0,
  • "limit_to_product_categories": [
    ],
  • "limit_to_products": [
    ],
  • "discount_product_id": "string",
  • "custom_field_values": [
    ],
  • "sys_deleted_by_id": "string",
  • "sys_version": 0,
  • "sys_created_at": "2019-08-24T14:15:22Z",
  • "sys_last_modified_at": "2019-08-24T14:15:22Z",
  • "sys_created_by_id": "string",
  • "sys_last_modified_by_id": "string",
  • "sys_external_id": "string",
  • "sys_locked": true,
  • "sys_bulk_load_pk": "string",
  • "sys_bulk_load_at": "string",
  • "sys_bulk_load_id": "string",
  • "sys_bulk_load_record_no": 0,
  • "sys_bulk_load_source_file": "string",
  • "sys_last_bulk_data_operation_id": "string",
  • "sys_last_bulk_data_operation_sys_version": "string",
  • "sys_directive": "string",
  • "sys_calculated_field_error": "string",
  • "sys_snapshot_base_version": 0,
  • "sys_has_files_in_s3": true,
  • "sys_configuration_snapshot_id": "string",
  • "sys_last_security_context": { },
  • "sys_calculated_field_errors": [
    ]
}

Updates a coupon with the specified ID.

This method will update an existing coupon with the specified ID.

Request
Security:
path Parameters
tenantId
required
string

The id of the tenant being accessed.

id
required
string

The ID of the coupon to update.

Request Body schema: application/json

The updated coupon that will be saved.

id
required
string (ID) /^[\w|-]+$/

The unique, string identifier of this coupon

name
required
string (Name)

The name of the coupon

code_generation_html
string (Code Generation Html)

HTML you can add into HTML generation for the code

expiration_date
string <date-time> (Expiration Date)

The date/time that this coupon expires

maximum_discount
number <float> (Maximum Discount)

The optional maximum discount that this coupon can yield, irrespective of its configuration

applies_to_miscellaneous_products
boolean (Applies To Miscellaneous Products)

Whether or not this coupon applies to misc products

limit_total_uses
integer (Limit Total Uses)

The maximum number of times this coupon can be used

limit_uses_per_customer
integer (Limit Uses Per Customer)

The maximum number of times this coupon can be used by a particular customer

is_active
required
boolean (Is Active)

Whether this coupon is enabled

type
required
string (Type)

The type of discount to apply

Enum: "fixed amount off order" "fixed amount off each item" "percentage off each item" "fixed amount off shipping" "free shipping"
amount
required
number <float> (Amount)

Amount of the discount

minimum_purchase
number <double> (Minimum Purchase)

Minimum a customer must purchase to qualify for coupon

limit_to_product_categories
Array of strings (Limit To Product Categories)

Limit purchase to particular product categories

limit_to_products
Array of strings (Limit To Products)

Limit purchase to particular products

discount_product_id
required
string (Discount Product)

The product uses for the discount code when it is at the order level

Array of objects (Custom Field Values)
sys_deleted_by_id
string (Sys Deleted By)

The ID of the user that deleted (or last tried to delete) this object

sys_version
number <float> (Sys Version)

A number representing the version of this record in the database

sys_created_at
required
string <date-time> (Sys Created At)

The date/time that this record was created, expressed in ISO-8601 date format

sys_last_modified_at
required
string <date-time> (Sys Last Modified At)

The date/time that this record record was last modified, expressed in ISO-8601 date format

sys_created_by_id
required
string (Sys Created By)

The ID of the user that created this record

sys_last_modified_by_id
required
string (Sys Last Modified By)

The ID of the user that last modified this record

sys_external_id
string (Sys External)

The ID that a record has from an external system or data import

sys_locked
boolean (Sys Locked)

If set, this record is locked and cannot be changed via the API

sys_bulk_load_pk
string (Sys Bulk Load Pk)

If this record was loaded via bulk, the tenant and key of the bulk load process used as a partition key

sys_bulk_load_at
string (Sys Bulk Load At)

If this record was loaded via bulk, the timestamp when the record was processed

sys_bulk_load_id
string (Sys Bulk Load)

If this record was loaded via bulk, the ID of the bulk load process

sys_bulk_load_record_no
number <float> (Sys Bulk Load Record No)

If this record was loaded via bulk, the record number in the source file

sys_bulk_load_source_file
string (Sys Bulk Load Source File)

If this record was loaded via bulk, the source file

sys_last_bulk_data_operation_id
string (Sys Last Bulk Data Operation)

If this record was last touched by a bulk data operation, the ID of that operation

sys_last_bulk_data_operation_sys_version
string (Sys Last Bulk Data Operation Sys Version)

If this record was last touched by a bulk data operation, the sys_version at the time of that operation

sys_directive
string (Sys Directive)

Means for passing directive information into an object processing logic

sys_calculated_field_error
string (Sys Calculated Field Error)

The error associated with the calculated field

sys_snapshot_base_version
number <float> (Sys Snapshot Base Version)

The version to use as a base when creating a configuration snapshot; if not set, 1 is used. Helpful when creating a sandbox

sys_has_files_in_s3
boolean (Sys Has Files In S3)

If true, this record has files in S3. If false, it doesnt, so no need to hit S3 upon deletion

sys_configuration_snapshot_id
string (Sys Configuration Snapshot)

If a snapshot was restored/applies to this record, the ID of the snapshot

sys_last_security_context
object (Sys Last Security Context)

The security context of the last insert, modify, or delete performed on this item

Array of objects
Responses
200The coupon was updated successfully.
400The coupon supplied was not valid.
401Unauthorized.
403Forbidden.
404The coupon could not be found.
409The coupon could not be saved because it refers to/depends on a non-existent object.
429Limit exceeded... unable to retrieve coupon based on tenant limits.
500General server error.
put/coupons/{tenantId}/{id}
Request samples
application/json
{
  • "id": "string",
  • "name": "string",
  • "code_generation_html": "string",
  • "expiration_date": "2019-08-24T14:15:22Z",
  • "maximum_discount": 0,
  • "applies_to_miscellaneous_products": true,
  • "limit_total_uses": 0,
  • "limit_uses_per_customer": 0,
  • "is_active": true,
  • "type": "fixed amount off order",
  • "amount": 0,
  • "minimum_purchase": 0,
  • "limit_to_product_categories": [
    ],
  • "limit_to_products": [
    ],
  • "discount_product_id": "string",
  • "custom_field_values": [
    ],
  • "sys_deleted_by_id": "string",
  • "sys_version": 0,
  • "sys_created_at": "2019-08-24T14:15:22Z",
  • "sys_last_modified_at": "2019-08-24T14:15:22Z",
  • "sys_created_by_id": "string",
  • "sys_last_modified_by_id": "string",
  • "sys_external_id": "string",
  • "sys_locked": true,
  • "sys_bulk_load_pk": "string",
  • "sys_bulk_load_at": "string",
  • "sys_bulk_load_id": "string",
  • "sys_bulk_load_record_no": 0,
  • "sys_bulk_load_source_file": "string",
  • "sys_last_bulk_data_operation_id": "string",
  • "sys_last_bulk_data_operation_sys_version": "string",
  • "sys_directive": "string",
  • "sys_calculated_field_error": "string",
  • "sys_snapshot_base_version": 0,
  • "sys_has_files_in_s3": true,
  • "sys_configuration_snapshot_id": "string",
  • "sys_last_security_context": { },
  • "sys_calculated_field_errors": [
    ]
}
Response samples
application/json
{
  • "id": "string",
  • "name": "string",
  • "code_generation_html": "string",
  • "expiration_date": "2019-08-24T14:15:22Z",
  • "maximum_discount": 0,
  • "applies_to_miscellaneous_products": true,
  • "limit_total_uses": 0,
  • "limit_uses_per_customer": 0,
  • "is_active": true,
  • "type": "fixed amount off order",
  • "amount": 0,
  • "minimum_purchase": 0,
  • "limit_to_product_categories": [
    ],
  • "limit_to_products": [
    ],
  • "discount_product_id": "string",
  • "custom_field_values": [
    ],
  • "sys_deleted_by_id": "string",
  • "sys_version": 0,
  • "sys_created_at": "2019-08-24T14:15:22Z",
  • "sys_last_modified_at": "2019-08-24T14:15:22Z",
  • "sys_created_by_id": "string",
  • "sys_last_modified_by_id": "string",
  • "sys_external_id": "string",
  • "sys_locked": true,
  • "sys_bulk_load_pk": "string",
  • "sys_bulk_load_at": "string",
  • "sys_bulk_load_id": "string",
  • "sys_bulk_load_record_no": 0,
  • "sys_bulk_load_source_file": "string",
  • "sys_last_bulk_data_operation_id": "string",
  • "sys_last_bulk_data_operation_sys_version": "string",
  • "sys_directive": "string",
  • "sys_calculated_field_error": "string",
  • "sys_snapshot_base_version": 0,
  • "sys_has_files_in_s3": true,
  • "sys_configuration_snapshot_id": "string",
  • "sys_last_security_context": { },
  • "sys_calculated_field_errors": [
    ]
}

Partially updates a coupon with the specified ID.

This method will patch an existing coupon with the specified ID, using the HTTP PATCH specification.

Request
Security:
path Parameters
tenantId
required
string

The id of the tenant being accessed.

id
required
string

The ID of the coupon to patch.

Request Body schema: application/json

The patch directives conforming to RFC 6902.

Array
op
required
string (Op)

The operation

Enum: "add" "remove" "replace" "move" "copy" "test"
path
required
string (Path)

The JSON path

value
string (Value)
Responses
200The coupon was patched successfully.
400The JSON patch directive you supplied was not valid.
401Unauthorized.
403Forbidden.
404The coupon could not be found.
409The coupon could not be saved because it refers to/depends on a non-existent object.
429Limit exceeded... unable to retrieve coupon based on tenant limits.
500General server error.
patch/coupons/{tenantId}/{id}
Request samples
application/json
[
  • {
    }
]
Response samples
application/json
{
  • "id": "string",
  • "name": "string",
  • "code_generation_html": "string",
  • "expiration_date": "2019-08-24T14:15:22Z",
  • "maximum_discount": 0,
  • "applies_to_miscellaneous_products": true,
  • "limit_total_uses": 0,
  • "limit_uses_per_customer": 0,
  • "is_active": true,
  • "type": "fixed amount off order",
  • "amount": 0,
  • "minimum_purchase": 0,
  • "limit_to_product_categories": [
    ],
  • "limit_to_products": [
    ],
  • "discount_product_id": "string",
  • "custom_field_values": [
    ],
  • "sys_deleted_by_id": "string",
  • "sys_version": 0,
  • "sys_created_at": "2019-08-24T14:15:22Z",
  • "sys_last_modified_at": "2019-08-24T14:15:22Z",
  • "sys_created_by_id": "string",
  • "sys_last_modified_by_id": "string",
  • "sys_external_id": "string",
  • "sys_locked": true,
  • "sys_bulk_load_pk": "string",
  • "sys_bulk_load_at": "string",
  • "sys_bulk_load_id": "string",
  • "sys_bulk_load_record_no": 0,
  • "sys_bulk_load_source_file": "string",
  • "sys_last_bulk_data_operation_id": "string",
  • "sys_last_bulk_data_operation_sys_version": "string",
  • "sys_directive": "string",
  • "sys_calculated_field_error": "string",
  • "sys_snapshot_base_version": 0,
  • "sys_has_files_in_s3": true,
  • "sys_configuration_snapshot_id": "string",
  • "sys_last_security_context": { },
  • "sys_calculated_field_errors": [
    ]
}

Returns a coupon from the system by its ID.

This method will delete a coupon with the specified ID.

Request
Security:
path Parameters
tenantId
required
string

The id of the tenant being accessed.

id
required
string

The ID of the coupon to delete.

Responses
200The coupon was deleted successfully.
400The request was not valid.
401Unauthorized.
403Forbidden.
404The coupon could not be found.
409The coupon could not be deleted because other objects refers to/depends on this one.
429Limit exceeded... unable to delete coupon based on tenant limits.
500General server error.
delete/coupons/{tenantId}/{id}
Request samples
curl -i -X DELETE \
  https://commerce.api.756794052567.rhythmsoftware.com/coupons/:tenantId/:id \
  -H 'Authorization: YOUR_API_KEY_HERE'
Response samples
application/json
"string"

Execute Batch Operations

TAllows you to perform up to 100 parallel patch/delete operations

Request
Security:
path Parameters
tenantId
required
string

The id of the tenant being accessed.

Request Body schema: application/json

The batch request

Array of objects
Responses
200Request completed successfully.
400The request was not valid.
401Unauthorized.
403Forbidden.
404The coupon could not be found.
429Limit exceeded... unable to retrieve coupon based on tenant limits.
500General server error.
post/coupons/{tenantId}/batch
Request samples
application/json
{
  • "operations": [
    ]
}
Response samples
application/json
{
  • "success_count": 0,
  • "error_count": 0,
  • "results": [
    ]
}