Promotion
Version: 1.0
You can use the Promotion resource to create a promotion.
Authenticated access scopes: com.read_discounts
, com.write_discounts
(Only used by the private app)
What you can do with Promotion
The Haravan API lets you do the following with the Promotion resource.
- GET
https://apis.haravan.com/com/promotions.json
- GET
https://apis.haravan.com/com/promotions/{promotion_id}.json
- POST
https://apis.haravan.com/com/promotions.json
- PUT
https://apis.haravan.com/com/discounts/{promotion_id}/enable.json
- PUT
https://apis.haravan.com/com/discounts/{promotion_id}/disable.json
- DELETE
https://apis.haravan.com/com/promotions/{promotion_id}.json
Properties
name
: string
"name": "Happy new year"
Name of the promotion.
ends_at
: string
"ends_at": "2022-08-11T09:35:59Z"
The date and time (ISO 8601 format) when the promotion was expired.
id
: number
"id": 1206854680
A unique identifier for the promotion.
starts_at
: string
"starts_at": "2021-05-13T07:29:20.1Z"
The date and time (ISO 8601 format) when the promotion was applied.
value
: number
"value ": 150000
Promotion value.
If promtion_type is "shipping". The value will be the shipping fee. It must be limited to how much shipping charges apply.
discount_type
: string
"discount_type": "fixed_amount"
- null: Apply to all orders.
- product: Apply to the product.
- collection: Apply to the collection.
- product_variant: Apply to product variants.
applies_to_quantity
: number
"applies_to_resource":0
Minimum quantity of items to be applied promotion.
applies_to_id
: number
"applies_to_id":0
The ID of the product to be applied promotion.
order_over
: number
"order_over":100000
Minimum purchase amount to be applied promotion.
promotion_apply_type
: number
"promotion_apply_type":1
1: Minimum quantity of items.
2: Minimum purchase amount.
variants
: array
"variants": [
{
"product_id": 1028183633,
"variant_id": 1061514629
},
{
"product_id": 1028183633,
"variant_id": 1061514630
}
]
Array to product ids and variant id objects to which the promotion will be applied.
created_at
: string
"created_at": "2021-05-13T07:29:20.1Z"
The date and time (ISO 8601 format) when the promotion was created.
updated_at
: string
"updated_at": "2021-05-13T07:29:20.808Z"
The date and time (ISO 8601 format) when the promotion was last updated.
first_name
: string
"first_name":"John"
The first name of the user created the promotion.
last_name
: string
"last_name":"Smit"
The last name of the user created the promotion.
create_user
: number
"create_user":200000493247
The ID of the user-created the promotion.
status
: string
"status":"enabled"
Status of the promotion. Values are valid:
- enabled: The promotion is active.
- disabled: The promotion is disabled.
Endpoints
Retrieves a list of enabling promotions
Parameters
limit
Limit of the result.
page
Page to show the result.
since_id
Restrict results to after the specified ID.
code
Filter result by the code.
Retrieves a list of enabling discount codes by page number.
By default, the number of resources on the page is 50.
- GET
https://apis.haravan.com/com/promotions.json?page=1
Details
HTTP/1.1 200 OK
{
"promotions": [
{
"name": "Happy new year",
"ends_at": "2022-03-04T16:59:59Z",
"id": 1024173229,
"starts_at": "2022-03-04T03:54:00Z",
"value": 10000.0000,
"discount_type": "fixed_amount",
"applies_to_resource": "product_variant",
"applies_to_quantity": 0,
"applies_to_id": 0,
"set_time_active": false,
"order_over": 1000000,
"promotion_apply_type": 2,
"variants": [
{
"product_id": 1028183633,
"variant_id": 1061514629
},
{
"product_id": 1028183633,
"variant_id": 1061514630
}
],
"created_at": "2022-03-04T03:56:37.215Z",
"updated_at": "2022-03-04T03:56:37.215Z",
"first_name": null,
"last_name": null,
"create_user": 200000493247,
"applies_customer_group_id": null,
"status": "enabled"
},
{
"name": "Vallentine",
"ends_at": "2022-08-11T09:35:59Z",
"id": 1022775866,
"starts_at": "2021-08-11T08:35:00Z",
"value": 10.0000,
"discount_type": "percentage",
"applies_to_resource": "product",
"applies_to_quantity": 1,
"applies_to_id": 1028183633,
"set_time_active": false,
"order_over": null,
"promotion_apply_type": 1,
"variants": [],
"created_at": "2022-01-25T12:07:59.374Z",
"updated_at": "2022-01-25T12:07:59.374Z",
"first_name": null,
"last_name": null,
"create_user": 200000497867,
"applies_customer_group_id": null,
"status": "enabled"
}
]
}
Retrieves single the promotion
Retrieves single the discount code.
- GET
https://apis.haravan.com/com/promotions/1024173229.json
Details
HTTP/1.1 200 OK
{
"promotion": {
"name": "Happy new year",
"ends_at": "2022-03-04T16:59:59Z",
"id": 1024173229,
"starts_at": "2022-03-04T03:54:00Z",
"value": 10000.0000,
"discount_type": "fixed_amount",
"applies_to_resource": "product_variant",
"applies_to_quantity": 0,
"applies_to_id": 0,
"set_time_active": false,
"order_over": 1000000,
"promotion_apply_type": 2,
"variants": [
{
"product_id": 1028183633,
"variant_id": 1061514629
},
{
"product_id": 1028183633,
"variant_id": 1061514630
}
],
"created_at": "2022-03-04T03:56:37.215Z",
"updated_at": "2022-03-04T03:56:37.215Z",
"first_name": null,
"last_name": null,
"create_user": 200000493247,
"applies_customer_group_id": null,
"status": "enabled"
}
}
Create a promotion
Create a promotion.
- POST
https://apis.haravan.com/com/promotions.json
{
"promotion":
{
"name": "Happy new year",
"ends_at": "2022-03-04T16:59:59Z",
"id": 1024173229,
"starts_at": "2022-03-04T03:54:00Z",
"value": 10000.0000,
"discount_type": "fixed_amount",
"applies_to_resource": "product_variant",
"applies_to_quantity": 0,
"applies_to_id": 0,
"order_over": 1000000,
"promotion_apply_type": 2,
"variants": [
{
"product_id": 1028183633,
"variant_id": 1061514629
},
{
"product_id": 1028183633,
"variant_id": 1061514630
}
]
}
}
Details
{
"promotion":
{
"name": "Happy new year",
"ends_at": "2022-03-04T16:59:59Z",
"id": 1024173229,
"starts_at": "2022-03-04T03:54:00Z",
"value": 10000.0000,
"discount_type": "fixed_amount",
"applies_to_resource": "product_variant",
"applies_to_quantity": 0,
"applies_to_id": 0,
"order_over": 1000000,
"promotion_apply_type": 2,
"variants": [
{
"product_id": 1028183633,
"variant_id": 1061514629
},
{
"product_id": 1028183633,
"variant_id": 1061514630
}
]
}
}
Update status enable a promotion
Update status enable a promotion.
- PUT
https://apis.haravan.com/com/discounts/1024177200/enable.json
{}
Details
HTTP/1.1 200 OK
{
"discount": {
"applies_once": false,
"applies_to_id": null,
"code": "Happy new year",
"ends_at": "2022-03-04T16:59:59Z",
"id": 1024177200,
"minimum_order_amount": 1000000.0,
"starts_at": "2022-03-03T17:00:00Z",
"status": "enabled",
"usage_limit": 0,
"value": 10000.0000,
"discount_type": "fixed_amount",
"times_used": 0,
"is_promotion": false,
"applies_to_resource": "product_variant",
"variants": [
{
"product_id": 1028183633,
"variant_id": 1061514629
},
{
"product_id": 1028183633,
"variant_id": 1061514630
}
],
"location_ids": null,
"create_user": 200000497867,
"first_name": null,
"last_name": null,
"applies_customer_group_id": null,
"created_at": "2022-03-04T07:58:40.772Z",
"updated_at": "2022-03-04T08:04:57.1469947Z",
"promotion_apply_type": 2,
"applies_to_quantity": 0,
"order_over": 1000000,
"is_new_coupon": true,
"channel": null,
"max_amount_apply": null,
"is_advance_same_price_discount": false,
"advance_same_prices": null,
"once_per_customer": false
}
}
Update status disable a promotion
Update status disable a promotion.
- PUT
https://apis.haravan.com/com/discounts/1017981791/disable.json
{}
Details
HTTP/1.1 200 OK
{
"discount": {
"applies_once": false,
"applies_to_id": null,
"code": "Happy new year",
"ends_at": "2022-03-04T16:59:59Z",
"id": 1024177200,
"minimum_order_amount": 1000000.0,
"starts_at": "2022-03-03T17:00:00Z",
"status": "disabled",
"usage_limit": 0,
"value": 10000.0000,
"discount_type": "fixed_amount",
"times_used": 0,
"is_promotion": false,
"applies_to_resource": "product_variant",
"variants": [
{
"product_id": 1028183633,
"variant_id": 1061514629
},
{
"product_id": 1028183633,
"variant_id": 1061514630
}
],
"location_ids": null,
"create_user": 200000497867,
"first_name": null,
"last_name": null,
"applies_customer_group_id": null,
"created_at": "2022-03-04T07:58:40.772Z",
"updated_at": "2022-03-04T08:06:28.493101Z",
"promotion_apply_type": 2,
"applies_to_quantity": 0,
"order_over": 1000000,
"is_new_coupon": true,
"channel": null,
"max_amount_apply": null,
"is_advance_same_price_discount": false,
"advance_same_prices": null,
"once_per_customer": false
}
}
Delete a promotion
Delete a promotion.
- DELETE
https://apis.haravan.com/com/promotions/1024177200.json
{}
Details
HTTP/1.1 200 OK
{}