# Campaign APIs
# Search API
Method: POST
Path: /promotion/api/project/{projectId}/search
Description: Search for matched campaign benefit actions based on given conditions
- Scope:
- camp.search
Examples Postman collection: Campaign-search collection
Request Header:
Param | Description | Required | Example |
---|---|---|---|
Authorization | The OAuth2 authentication with the O2O System | Y | Bearer {O2O Access Token} |
Content-Type | The MIME type of this content | Y | application/json |
Request Body
Param | Description | Type | Required | Example | ||
---|---|---|---|---|---|---|
channel | The channel that perform searching used for analytic purpose | String | Y | WEMALLAPP | ||
attribute | Map of custom attribute with arbitrary string keys and values | Map<String, String> | Y | | ||
cart | Object that represent states of user's cart | Object | Y | | ||
totalPrice | Price of the whole cart that user has to pay | Number | N | 200.50 | ||
currency | Currency of cart total price | String | N | USD | ||
items | List of picked items in user's cart | List<Object> | Y | | ||
name | Name of item | String | N | Item A | ||
sku | Sku ID | String | N | A0001 | ||
amount | Amount of the item in cart | Number | N | 4 | ||
price | Price of the item in cart | Number | N | 800.0 | ||
tags | List of item tags | List<String> | Y | ["category1", "category2"] |
Example Request:
curl -X POST \
'https://platform.weomni-test.com/promotion/api/projects/12791v1a6104ka02/search' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {O2O Access Token}' \
-d '{
"channel": "WEMALLAPP",
"attribute": {
"my-key": "my-value",
"your-key": "your-value"
},
"cart": {
"totalPrice": "700.0",
"currency": "THB",
"items": [
{
"name": "Item A",
"sku": "A0001",
"amount": "2",
"price": "400.0",
"tags": [
"category1",
"category2"
]
},
{
"name": "Item B",
"sku": "B0001",
"amount": "3",
"price": "300.0",
"tags": [
"category3",
"category4"
]
}
]
}
}
'
Example Response:
{
"attribute": {
"my-key": "my-value",
"your-key": "your-value"
},
"actions": [
{
"rule": {
"id": "e2fd185b-e3d4-461f-9055-4301f650b53c",
"name": "Test Rule",
"thenOperator": "OR"
},
"campaign": {
"id": "5d259d2d30cfd2000151c0ed",
"name": "Test Campaign",
"startDate": "2018-12-31T17:00:00Z",
"endDate": null,
"refCode": "TESTCAMPAIGN",
"imageUrl": null
},
"action": {
"action": "FREE_GIFT",
"internalAction": false,
"autoRedeem": false,
"actionRef": "5d259d2d30cfd2000151b0ed",
"data": [
{
"attribute": "sku",
"value": "C0001",
"note": "",
"resolveAction": false
},
{
"attribute": "amount",
"value": "1",
"note": "",
"resolveAction": false
}
]
}
},
{
"rule": {
"id": "a9rf132r-t4t4-981g-9354-4331r350b45f",
"name": "Test Rule",
"thenOperator": "OR"
},
"campaign": {
"id": "5d259d2d30cfd2000151c0ed",
"name": "Test Campaign",
"startDate": "2018-12-31T17:00:00Z",
"endDate": null,
"refCode": "TESTCAMPAIGN",
"imageUrl": null
},
"action": {
"action": "FREE_GIFT",
"internalAction": false,
"actionRef": "6f259d3ft0cfd2450151b45r",
"autoRedeem": true,
"data": [
{
"attribute": "sku",
"value": "C0002",
"note": "",
"resolveAction": false
},
{
"attribute": "amount",
"value": "1",
"note": "",
"resolveAction": false
}
]
}
}
]
}
Response Codes:
HTTP Status Code | Description | Remark |
---|---|---|
200 | OK | Successfully searched |
400 | Bad Request | Required fields is not defined or invalid value format |
401 | Unauthorized | Access Token is invalid or expired |
403 | Forbidden | No Permission |
# Redeem API
Method: POST
Path: /promotion/api/project/{projectId}/redeem/campaign-code
Description: redeem campaign by matched action from search API response
- Scope:
- camp.redeem.w
Examples Postman collection: Campaign-redeem collection
Request Header:
Param | Description | Required | Example |
---|---|---|---|
Authorization | The OAuth2 authentication with the O2O System | Y | Bearer {O2O Access Token} |
Content-Type | The MIME type of this content | Y | application/json |
Redeem Type
- Redeem by campaign ref code will redeem all action under the campaign code. It require search request and campaign code to specific
Auto Redeem
It requires to lookup autoRedeem
field from Campaign search response
field | Value | Description |
---|---|---|
autoRedeem | true | The action must redeem automaticaly after doing some action relate to the campaign |
false | The action can redeem after selection an action to redeem |
Request Body
Param | Description | Type | Require |
---|---|---|---|
campaignCode | Specific Campaign Code from search response will redeem all action in the campaign | String | Y |
{
"campaignCode": "rule1",
"attribute": {
"my-key": "my-value",
"your-key": "your-value"
},
"cart": {
"totalPrice": "700.0",
"currency": "THB",
"items": [
{
"name": "Item A",
"sku": "A0001",
"amount": "2",
"price": "400.0",
"tags": [
"category1",
"category2"
]
},
{
"name": "Item B",
"sku": "B0001",
"amount": "3",
"price": "300.0",
"tags": [
"category3",
"category4"
]
}
]
}
}
Response Body
{
"id": "f898cb5d-e631-4e87-98d8-1e448aecd0cb",
"campaignCode": "rule1",
"txRef": "1571373074518",
"actionTxs": [
{
"id": "5d259d2d30cfd2000151b0ed",
"externalTxRef": null,
"status": "COMPLETE",
"then": {
"action": "FREE_GIFT",
"internalAction": false,
"actionRef": "e2fd185b-e3d4-461f-9055-4301f650b53c",
"data": [
{
"type": null,
"attribute": "sku",
"value": "C0001",
"note": "",
"valueType": "STRING",
"resolveAction": false
},
{
"type": null,
"attribute": "amount",
"value": "1",
"note": "",
"valueType": "STRING",
"resolveAction": false
}
]
},
"projectId": "5d24531d81a04c0001f46c6c",
"errors": []
},
{
"id": "6f259d3ft0cfd2450151b45r",
"externalTxRef": null,
"status": "COMPLETE",
"then": {
"action": "FREE_GIFT",
"internalAction": false,
"actionRef": "a9rf132r-t4t4-981g-9354-4331r350b45f",
"data": [
{
"type": null,
"attribute": "sku",
"value": "C0002",
"note": "",
"valueType": "STRING",
"resolveAction": false
},
{
"type": null,
"attribute": "amount",
"value": "1",
"note": "",
"valueType": "STRING",
"resolveAction": false
}
]
},
"projectId": "5d24531d81a04c0001f46c6c",
"errors": []
}
],
"attribute": {
"mobile": "081111111",
"action": "purchase",
"customerGrading": "diamond"
},
"cart": {},
"status": "COMPLETE",
"manualAcknowledge": false,
"couponCode": null,
"errors": [],
"projectId": "5d24531d81a04c0001f46c6c"
}
# Multiple Redeem API
Method: POST
Path: /promotion/api/project/{projectId}/redeem-bulk/campaign-code
Description: multiple redeem campaign by matched action from search API response
- Scope:
- camp.redeem.w
Examples Postman collection: Campaign-bulk-redeem collection
Request Header:
Param | Description | Required | Example |
---|---|---|---|
Authorization | The OAuth2 authentication with the O2O System | Y | Bearer {O2O Access Token} |
Content-Type | The MIME type of this content | Y | application/json |
Redeem Type
- Redeem by campaign ref code will redeem all action under the campaign code. It require search request and campaign code to specific
Auto Redeem
It requires to lookup autoRedeem
field from Campaign search response
field | Value | Description |
---|---|---|
autoRedeem | true | The action must redeem automaticaly after doing some action relate to the campaign |
false | The action can redeem after selection an action to redeem |
Request Body
Param | Description | Type | Require |
---|---|---|---|
campaignCode | Specific Campaign Code from search response will redeem all action in the campaign | String | Y |
[
{
"campaignCode": "rule1",
"attribute": {
"my-key": "my-value",
"your-key": "your-value"
},
"channel": "welove",
"cart": {
"totalPrice": "700.0",
"currency": "THB",
"items": [
{
"name": "Item A",
"sku": "A0001",
"amount": "2",
"price": "400.0",
"tags": [
"category1",
"category2"
]
},
{
"name": "Item B",
"sku": "B0001",
"amount": "3",
"price": "300.0",
"tags": [
"category3",
"category4"
]
}
]
}
},
{
"campaignCode": "rule",
"attribute": {
"my-key": "my-value",
"your-key": "your-value"
},
"channel": "welove",
"cart": {
"totalPrice": "700.0",
"currency": "THB",
"items": [
{
"name": "Item A",
"sku": "A0001",
"amount": "2",
"price": "400.0",
"tags": [
"category1",
"category2"
]
},
{
"name": "Item B",
"sku": "B0001",
"amount": "3",
"price": "300.0",
"tags": [
"category3",
"category4"
]
}
]
}
}
]
Response Body
[
{
"id": "f898cb5d-e631-4e87-98d8-1e448aecd0cb",
"campaignCode": "rule1",
"txRef": "1571373074518",
"actionTxs": [
{
"id": "5d259d2d30cfd2000151b0ed",
"externalTxRef": null,
"status": "COMPLETE",
"then": {
"action": "FREE_GIFT",
"internalAction": false,
"actionRef": "e2fd185b-e3d4-461f-9055-4301f650b53c",
"data": [
{
"type": null,
"attribute": "sku",
"value": "C0001",
"note": "",
"valueType": "STRING",
"resolveAction": false
},
{
"type": null,
"attribute": "amount",
"value": "1",
"note": "",
"valueType": "STRING",
"resolveAction": false
}
]
},
"projectId": "5d24531d81a04c0001f46c6c",
"errors": []
},
{
"id": "6f259d3ft0cfd2450151b45r",
"externalTxRef": null,
"status": "COMPLETE",
"then": {
"action": "FREE_GIFT",
"internalAction": false,
"actionRef": "a9rf132r-t4t4-981g-9354-4331r350b45f",
"data": [
{
"type": null,
"attribute": "sku",
"value": "C0002",
"note": "",
"valueType": "STRING",
"resolveAction": false
},
{
"type": null,
"attribute": "amount",
"value": "1",
"note": "",
"valueType": "STRING",
"resolveAction": false
}
]
},
"projectId": "5d24531d81a04c0001f46c6c",
"errors": []
}
],
"attribute": {
"mobile": "081111111",
"action": "purchase",
"customerGrading": "diamond"
},
"cart": {},
"status": "COMPLETE",
"manualAcknowledge": false,
"couponCode": null,
"errors": [],
"projectId": "5d24531d81a04c0001f46c6c"
},
{
"id": "f5d2453d-f827-74e6-zo62-1a04c01f46c",
"campaignCode": "rule2",
"txRef": "1571373074518",
"actionTxs": [
{
"id": "5d259d2d30cfd2000151b0ed",
"externalTxRef": null,
"status": "COMPLETE",
"then": {
"action": "FREE_GIFT",
"internalAction": false,
"actionRef": "e2fd185b-e3d4-461f-9055-4301f650b53c",
"data": [
{
"type": null,
"attribute": "sku",
"value": "C0001",
"note": "",
"valueType": "STRING",
"resolveAction": false
},
{
"type": null,
"attribute": "amount",
"value": "1",
"note": "",
"valueType": "STRING",
"resolveAction": false
}
]
},
"projectId": "5d24531d81a04c0001f46c6c",
"errors": []
},
{
"id": "6f259d3ft0cfd2450151b45r",
"externalTxRef": null,
"status": "COMPLETE",
"then": {
"action": "FREE_GIFT",
"internalAction": false,
"actionRef": "a9rf132r-t4t4-981g-9354-4331r350b45f",
"data": [
{
"type": null,
"attribute": "sku",
"value": "C0002",
"note": "",
"valueType": "STRING",
"resolveAction": false
},
{
"type": null,
"attribute": "amount",
"value": "1",
"note": "",
"valueType": "STRING",
"resolveAction": false
}
]
},
"projectId": "5d24531d81a04c0001f46c6c",
"errors": []
}
],
"attribute": {
"mobile": "081111111",
"action": "purchase",
"customerGrading": "diamond"
},
"cart": {},
"status": "COMPLETE",
"manualAcknowledge": false,
"couponCode": null,
"errors": [],
"projectId": "5d24531d81a04c0001f46c6c"
}
]
- Redeem by action ref code will redeem specific action to redeem
Request Body
Param | Description | Type | Require |
---|---|---|---|
campaignCode | Specific campaign code from search response for notify which campaign will be redeemed | String | Y |
actionRefs | Specific action reference code that need to redeem | List of String | N |
[
{
"campaignCode": "rule1",
"actionRefs": [
"6ec878a3-6f81-4746-8852-a0372df5b4e1"
]
"attribute": {
"my-key": "my-value",
"your-key": "your-value"
},
"cart": {
"totalPrice": "700.0",
"currency": "THB",
"items": [
{
"name": "Item A",
"sku": "A0001",
"amount": "2",
"price": "400.0",
"tags": [
"category1",
"category2"
]
},
{
"name": "Item B",
"sku": "B0001",
"amount": "3",
"price": "300.0",
"tags": [
"category3",
"category4"
]
}
]
}
},
{
"campaignCode": "rule2",
"actionRefs": [
"6ec878a3-6f81-4746-8852-a0372df5b4e1"
]
"attribute": {
"my-key": "my-value",
"your-key": "your-value"
},
"cart": {
"totalPrice": "700.0",
"currency": "THB",
"items": [
{
"name": "Item A",
"sku": "A0001",
"amount": "2",
"price": "400.0",
"tags": [
"category1",
"category2"
]
},
{
"name": "Item B",
"sku": "B0001",
"amount": "3",
"price": "300.0",
"tags": [
"category3",
"category4"
]
}
]
}
}
]
Response Body
[
{
"id": "f898cb5d-e631-4e87-98d8-1e448aecd0cb",
"campaignCode": "rule1",
"channel": "welove",
"txRef": "1571373074518",
"actionTxs": [
{
"createdBy": "trueid-21971788",
"createdDate": "2019-10-18T04:31:23.238Z",
"lastModifiedBy": "trueid-21971788",
"lastModifiedDate": "2019-10-18T04:31:23.238Z",
"id": "5da9401b5272cd0001d5b63a",
"externalTxRef": null,
"status": "COMPLETE",
"then": {
"action": "DISCOUNT",
"internalAction": false,
"actionRef": "6ec878a3-6f81-4746-8852-a0372df5b4e1",
"data": [
{
"type": null,
"attribute": "amount",
"op": null,
"value": "500",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": null,
"attribute": "currency",
"op": null,
"value": "THB",
"valueType": "STRING",
"note": null,
"resolveAction": false
}
]
},
"projectId": "5d24531d81a04c0001f46c6c",
"errors": []
}
],
"attribute": {
"mobile": "081111111",
"action": "purchase",
"customerGrading": "diamond"
},
"cart": {},
"status": "COMPLETE",
"manualAcknowledge": false,
"couponCode": null,
"errors": [],
"projectId": "5d24531d81a04c0001f46c6c",
"actionRefs": [
"6ec878a3-6f81-4746-8852-a0372df5b4e1"
]
},
{
"id": "8eh883a3-6r82-8263-8852-a0322s75f5e2",
"campaignCode": "rule2",
"channel": "welove",
"txRef": "1571373074518",
"actionTxs": [
{
"createdBy": "trueid-21971788",
"createdDate": "2019-10-18T04:31:23.238Z",
"lastModifiedBy": "trueid-21971788",
"lastModifiedDate": "2019-10-18T04:31:23.238Z",
"id": "5da9401b5272cd0001d5b63a",
"externalTxRef": null,
"status": "COMPLETE",
"then": {
"action": "DISCOUNT",
"internalAction": false,
"actionRef": "6ec878a3-6f81-4746-8852-a0372df5b4e1",
"data": [
{
"type": null,
"attribute": "amount",
"op": null,
"value": "500",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": null,
"attribute": "currency",
"op": null,
"value": "THB",
"valueType": "STRING",
"note": null,
"resolveAction": false
}
]
},
"projectId": "5d24531d81a04c0001f46c6c",
"errors": []
}
],
"attribute": {
"mobile": "081111111",
"action": "purchase",
"customerGrading": "diamond"
},
"cart": {},
"status": "COMPLETE",
"manualAcknowledge": false,
"couponCode": null,
"errors": [],
"projectId": "5d24531d81a04c0001f46c6c",
"actionRefs": [
"6ec878a3-6f81-4746-8852-a0372df5b4e1"
]
}
]
Response Codes:
HTTP Status Code | Description | Remark |
---|---|---|
200 | OK | Successfully searched |
400 | Bad Request | Required fields is not defined or invalid value format |
401 | Unauthorized | Access Token is invalid or expired |
403 | Forbidden | No Permission |
410 | EXCEED_CAMPAIGN_QUOTA_LIMIT | Exceed campaign quota |
# Void API
Method: PUT
Path: /promotion/api/projects/{projectId}/redeems/{redemptionTxId}/status/void
Description: Search for matched campaign benefit actions based on given conditions
- Scope:
- camp.redeem.w
Examples Postman collection: Redemption-void collection
Request Header:
Param | Description | Required | Example |
---|---|---|---|
Authorization | The OAuth2 authentication with the O2O System | Y | Bearer {O2O Access Token} |
Content-Type | The MIME type of this content | Y | application/json |
Response code:
Code | Description | Remark |
---|---|---|
200 | OK | successful |
401 | Unauthorized | Access Token is invalid or expired |
403 | Forbidden | No Permission |
404 | Not found | ProjectId or redemptionTxId is invalid |
Example Request:
curl -X GET \
'https://platform.weomni-test.com/promotion/api/projects/5d24531d81a04c0001f46c6c/redeems/1571373074518/status/void \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {O2O Access Token}'
Example Response:
no content
# Management APIs
# Campaign List and Filtering
Method: GET
Path: /promotion/api/project/{projectId}/campaigns
Description: Get the list of all campaigns based on the project ID and filtering parameters
- Scope:
- camp.camp.r
Examples Postman collection: Campaign-filter collection
Request Header:
Param | Description | Required | Example |
---|---|---|---|
Authorization | The OAuth2 authentication with the O2O System | Y | Bearer {O2O Access Token} |
Content-Type | The MIME type of this content | Y | application/json |
Filtering Parameters:
Parameter | Description | Example |
---|---|---|
conditions[attributeName].value.equals | The condition attribute value in any rules should equals | ?conditions[merchantId].value.equals=1100001 |
conditions[attributeName].value.greaterThan | The condition attribute value in any rules should be greater than | ?conditions[spentHours].value.greaterThan=3 |
conditions[attributeName].value.greaterOrEqualThan | The condition attribute value in any rules should be greater or equal than | ?conditions[spentHours].value.greaterOrEqualThan=3 |
conditions[attributeName].value.lessThan | The condition attribute value in any rules should equals | ?conditions[merchantId].value.lessThan=3 |
conditions[attributeName].value.lessOrEqualThan | The condition attribute value in any rules should be greater than | ?conditions[spentHours].value.lessOrEqualThan=3 |
conditions[attributeName].value.in | It filters the condition attribute values in format ("a","b",...) | ?conditions[brand].value.in=a,b,c |
actionData[attributeName].value.equals | The action attribute value in any rules should be greater or equal than | ?actionData[point].value.equals=200 |
actionData[attributeName].value.greaterThan | The action attribute value in any rules should be greater than | ?actionData[point].value.greaterThan=200 |
actionData[attributeName].value.greaterOrEqualThan | The action attribute value in any rules should be greater or equal than | ?actionData[point].value.greaterOrEqualThan=200 |
actionData[attributeName].value.lessThan | The action attribute value in any rules should equals | ?actionData[point].value.lessThan=200 |
actionData[attributeName].value.lessOrEqualThan | The action attribute value in any rules should be greater than | ?actionData[point].value.lessOrEqualThan=200 |
quota.specified | The quota of campaigns should be specified | ?quota.specified=true |
startDate.equals | The start date of campaigns should equals to | ?startDate.equals=1998-05-08T15:53:00Z |
startDate.greaterThan | The start date of campaigns should be after | ?startDate.greaterThan=1998-05-08T15:53:00Z |
startDate.greaterOrEqualThan | The start date of campaigns should be after or equal than | ?startDate.greaterOrEqualThan=1998-05-08T15:53:00Z |
startDate.lessThan | The start date of campaigns should be before | ?startDate.lessThan=1998-05-08T15:53:00Z |
startDate.lessOrEqualThan | The start date of campaigns be before or equal | ?startDate.lessOrEqualThan=1998-05-08T15:53:00Z |
endDate.equals | The end date of campaigns should equals to | ?endDate.equals=1998-05-08T15:53:00Z |
endDate.greaterThan | The end date of campaigns should be after | ?endDate.greaterThan=1998-05-08T15:53:00Z |
endDate.greaterOrEqualThan | The end date of campaigns should be after or equal than | ?endDate.greaterOrEqualThan=1998-05-08T15:53:00Z |
endDate.lessThan | The end date of campaigns should be before | ?endDate.lessThan=1998-05-08T15:53:00Z |
endDate.lessOrEqualThan | The end date of campaigns be before or equal | ?endDate.lessOrEqualThan=1998-05-08T15:53:00Z |
lastModifiedDate.equals | The last modified date of campaigns should equals to | ?lastModifiedDate.equals=1998-05-08T15:53:00Z |
lastModifiedDate.greaterThan | The last modified date of campaigns should be after | ?lastModifiedDate.greaterThan=1998-05-08T15:53:00Z |
lastModifiedDate.greaterOrEqualThan | The last modified date of campaigns should be after or equal than | ?lastModifiedDate.greaterOrEqualThan=1998-05-08T15:53:00Z |
lastModifiedDate.lessThan | The last modified date of campaigns should be before | ?lastModifiedDate.lessThan=1998-05-08T15:53:00Z |
lastModifiedDate.lessOrEqualThan | The last modified date of campaigns be before or equal | ?lastModifiedDate.lessOrEqualThan=1998-05-08T15:53:00Z |
Response code:
Code | Description | Remark |
---|---|---|
200 | OK | successful |
401 | Unauthorized | Access Token is invalid or expired |
403 | Forbidden | No Permission |
404 | Not found | ProjectId or parameter is invalid |
Example Request:
curl -X GET \
'https://platform.weomni-test.com/promotion/api/projects/12791v1a6104ka02/campaigns?endDate.equals=2019-08-01T00:00:00Z' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {O2O Access Token}'
Example Response:
HTTP/1.1 200 OK
Content-Type: application/json
{
name: "Buy 2 A002 Free A003",
campaignCode: "BUY2A002FREEA003",
startDate: "2019-07-01T00:00:00Z",
endDate: "2019-08-01T00:00:00Z",
rules:[
{
when: {
conditions:[
{ type: "cartItem", attribute: "sku", op:"EQ", value:"A002" },
{ type: "cartItem", attribute: "amount", op:"GTE", value:"2" }
]
},
then: {
data:[
{ attribute: "sku", value: "A003" },
{ attribute: "amount", value: "1" }
]
}
}
]
}
Examples Scenario:
Scenario: As an administrator, I would like to see campaigns that give SKU "A003" on between 1st June 2019 and 1st July 2019
Given I have campaigns in system:
{
name: "Buy 2 A001 Free A003",
campaignCode: "BUY2A001FREEA003",
startDate: "2019-06-08T00:00:00Z",
endDate: "2019-07-08T00:00:00Z",
rules:[
{
when: {
conditions:[
{ type: "cartItem", attribute: "sku", op:"EQ", value:"A001" },
{ type: "cartItem", attribute: "amount", op:"GTE", value:"2" }
]
},
then: {
data:[
{ attribute: "sku", value: "A003" },
{ attribute: "amount", value: "1" }
]
}
}
]
}
And I have campaigns in system:
{
name: "Buy 2 A002 Free A003",
campaignCode: "BUY2A002FREEA003",
startDate: "2019-07-01T00:00:00Z",
endDate: "2019-08-01T00:00:00Z",
rules:[
{
when: {
conditions:[
{ type: "cartItem", attribute: "sku", op:"EQ", value:"A002" },
{ type: "cartItem", attribute: "amount", op:"GTE", value:"2" }
]
},
then: {
data:[
{ attribute: "sku", value: "A003" },
{ attribute: "amount", value: "1" }
]
}
}
]
}
When call..
GET /promotion/api/project/{projectId}/campaigns
?actionData[sku].value.equals=A003
&startDate.lessOrEqualThan=2019-06-01T00:00:00Z
&endDate.greaterOrEqualThan=2019-07-01T00:00:00Z
Then I should get response as:
[{
name: "Buy 2 A001 Free A003",
campaignCode: "BUY2A001FREEA003",
startDate: "2019-06-08T00:00:00Z",
endDate: "2019-07-08T00:00:00Z",
rules:[
{
when: {
conditions:[
{ type: "cartItem", attribute: "sku", op:"EQ", value:"A001" },
{ type: "cartItem", attribute: "amount", op:"GTE", value:"2" }
]
},
then: {
data:[
{ attribute: "sku", value: "A003" },
{ attribute: "amount", value: "1" }
]
}
}
]
}]
# Create Campaign
Method: POST
Path: /promotion/api/project/{projectId}/campaigns
Description: Create a campaign based on the project id
- Scope:
- camp.camp.w
Examples Postman collection: Campaign-filter collection
Request Header:
Param | Description | Required | Example |
---|---|---|---|
Authorization | The OAuth2 authentication with the O2O System | Y | Bearer {O2O Access Token} |
Content-Type | The MIME type of this content | Y | application/json |
Request Parameters:
Param | Description | Required | Example |
---|---|---|---|
ignoreReload | The flag that indicate if the campaign will be loaded to rule engine or not | N | /promotion/api/project/{projectId}/campaigns?ignoreReload=true |
Request Body:
Field | Description | Type | Required | Default | Format | Note |
---|---|---|---|---|---|---|
name | Name of the campaign | String | N | |||
groupName | Group Name of the campaign | String | N | |||
description | Description of the campaign | String | N | |||
channel | Channel of the campaign | String | N | |||
imageUrl | Url uploaded image of the campaign | String | N | |||
refCode | Campaign code of the campaign | String | Y | Value is not empty string | ||
startDate | Start date of the campaign | String | Y | YYYY-MM-DDTHH:mm:ssZ | Value must be set before end date | |
endDate | End date of the campaign | String | N | YYYY-MM-DDTHH:mm:ssZ | Value must be set after start date | |
rules | Rules of the campaign | List of Rule object | N | |||
rules[*].name | Name of rule | String | Y | Value is not empty string | ||
rules[*].description | Description of rule | String | N | |||
rules[*].when | Condition group for redeem campaign of rule | List of When object | N | |||
rules[*].when[*].match | Field information of each when for define when can redeem by match all conditions or match some conditions | String | N | Now, Value can be set with "ALL" only | ||
rules[*].when[*].conditions | Conditions of when for redeem campaign | List of Condition object | N | |||
rules[*].when[*].conditions[*].type | Field information for categorization condition | String | N | Value can be set with "custom" or "cart" or "cartItem" only | ||
rules[*].when[*].conditions[*].attribute | Attribute name of condition | String | N | |||
rules[*].when[*].conditions[*].op | Operator for compare condition | String | N | Value can be set with "eq", "neq", "gt", "gte", "lt", "lte", "in", "not_in", "matches", "not_matches", "contains", "not_contains" only | ||
rules[*].when[*].conditions[*].value | Value of condition | String | Y | Value is not empty string | ||
rules[*].when[*].conditions[*].valueType | Type of value in condition | String | N | "STRING" | Value can be set with "STRING" or "cart" or "NUMBER" only | |
rules[*].when[*].conditions[*].note | Description of condition | String | N | |||
rules[*].thenOperator | Field information of rule for define rule can redeem by select action when value is "OR" | String | N | "AND" | Value can be set with "AND" or "OR" only | |
rules[*].then | Benefit action group of rule | List of Then object | N | |||
rules[*].then[*].action | Name of action | String | N | |||
rules[*].then[*].internalAction | Flag of action for define when redeem will call to other services | Boolean | N | false | ||
rules[*].then[*].data | Benefit group of action | List of Condition object | N | |||
rules[*].then[*].data[*].attribute | Field name of benefit | String | N | |||
rules[*].then[*].data[*].value | Value of benefit | String | Y | Value is not empty string | ||
rules[*].then[*].data[*].note | Description of benefit | String | N | |||
rules[*].then[*].data[*].resolveAction | Flag of benefit value for define value field can resolve by expressions | Boolean | N | false | ||
rules[*].quotas | Quota group for limitation campaign | List of Quota object | N | |||
rules[*].quotas[*].key | Key of quota for summarize limitation campaign | String | Y | ${fieldName1}-${fieldName2} | ||
rules[*].quotas[*].value | Value is limit value of quota | String | Y | |||
rules[*].quotas[*].valueField | Field name for get value from Field attribute in redemption request in order to summarize limitation campaign | String | N | |||
rules[*].quotas[*].description | Description of quota | String | N | |||
status | Status of the campaign | String | N | Value can be set "ENABLE" or "DISABLE" only | ||
version | Version of the campaign for check optimistic locking | Integer | N | 0 |
Request Body Example:
{
"name": "WeMall 11/11",
"groupName": "WeMall",
"description": "WeMall 11/11",
"refCode": "WM00001",
"channel": "WMAPP",
"imageUrl": "http://test.com/test.png",
"status": "ENABLE",
"startDate": "1998-05-08T15:53:00Z",
"endDate": "2019-08-01T00:00:00Z",
"rules": [
{
"name": "Buy iPhone, Free Leather Case",
"description": "Buy iPhone, Free Leather Case",
"when": [
{
"match": "ALL",
"conditions": [
{
"type": "custom",
"attribute": "customerGrading",
"op": "eq",
"value": "diamond",
"valueType": "STRING",
"note": ""
},
{
"type": "cartItem",
"attribute": "sku",
"op": "eq",
"value": "IPHONE-2019",
"valueType": "STRING",
"note": ""
},
{
"type": "cartItem",
"attribute": "tags",
"op": "contains",
"value": "apple",
"valueType": "STRING",
"note": ""
},
{
"type": "cartItem",
"attribute": "amount",
"op": "eq",
"value": "1"
"valueType": "NUMBER",
"note": ""
}
]
}
],
"then": [
{
"action": "FREE_GIFT",
"data": [
{
"attribute": "sku",
"value": "IPHONE-2019-LEATHER-CASE",
"note": ""
},
{
"attribute": "amount",
"value": "1",
"note": ""
}
]
}
]
}
],
"quotas": [
{
"valueField": "purchaseAmount",
"key": "${merchantId}-${outletId}",
"value": 5000,
"description": "5000 bath use only for all promotion period"
}
]
}
Request Example:
curl -X POST \
https://alpha-platform.weomni-test.com/promotion/api/projects/5d2ef2d0f085380001da6a5d/campaigns \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {O2O Access Token}' \
-d '{
"name": "WeMall 11/11",
"groupName": "WeMall",
"description": "WeMall 11/11",
"startDate": "1998-05-08T15:53:00Z",
"endDate": "2019-08-01T00:00:00Z",
"refCode": "WM00001",
"status": "ENABLE",
"channel": "WMAPP",
"imageUrl": "http://test.com/test.png",
"quotas": [
{
"value": "5000",
"key": "${merchantId}-${outletId}",
"valueField": "purchaseAmount",
"description": "5000 bath use only for all promotion period"
}
],
"rules": [
{
"name": "Buy iPhone, Free Leather Case",
"description": "Buy iPhone, Free Leather Case",
"when": [
{
"match": "ALL",
"conditions": [
{
"type": "custom",
"attribute": "customerGrading",
"op": "eq",
"value": "diamond",
"valueType": "STRING",
"note": ""
},
{
"type": "cartItem",
"attribute": "amount",
"op": "eq",
"value": "1",
"valueType": "NUMBER",
"note": ""
},
{
"type": "cartItem",
"attribute": "sku",
"op": "eq",
"value": "IPHONE-2019",
"valueType": "STRING",
"note": ""
},
{
"type": "cartItem",
"attribute": "tags",
"op": "contais",
"value": "apple",
"valueType": "STRING",
"note": ""
}
]
}
],
"thenOperator": "AND",
"then": [
{
"data": [
{
"type": "custom",
"attribute": "sku",
"value": "IPHONE-2019-LEATHER-CASE",
"valueType": "STRING"
},
{
"type": "custom",
"attribute": "amount",
"value": "1",
"valueType": "STRING"
}
]
}
]
}
],
"version": 0
}'
Response Codes:
HTTP Status Code | Description | Message |
---|---|---|
201 | Create campaign successfully | |
400 | Create campaign with duplicated id | A new campaign cannot already have an ID |
400 | Create campaign with duplicated ref code | Duplicate refCode |
400 | Create campaign with duplicated rule name | Duplicated rule name: ${ruleName} |
400 | Create campaign with missing required field | NotNull, NotBlank |
400 | Create campaign with date time incorrect format | JSON parse error: Cannot deserialize value of type java.time.ZonedDateTime |
400 | Create campaign with start date after end date | Method argument not valid |
400 | Create campaign with incorrect format condition attributes | ValidConditionAttributeValue |
400 | Create campaign with valueType NUMBER but value is in incorrect format | JSON parse error: The attribute value is not a number (valueType = NUMBER) |
400 | Create campaign with valueType STRING but value is empty or null | NotBlankString |
401 | Unauthorized | |
403 | Forbidden | |
500 | Internal Server Error |
Response Success Example:
HTTP/1.1 201 Created
Content-Type: application/json
{
"createdBy": "66958747575",
"createdDate": "2019-10-15T08:14:37.156Z",
"lastModifiedBy": "66958747575",
"lastModifiedDate": "2019-10-15T08:14:37.156Z",
"id": "5da57fed5272cd0001d5b62a",
"name": "WeMall 11/11",
"groupName": "WeMall",
"description": "WeMall 11/11",
"startDate": "1998-05-08T15:53:00Z",
"endDate": "2019-08-01T00:00:00Z",
"refCode": "WM00001",
"status": "ENABLE",
"channel": "WMAPP",
"imageUrl": "http://test.com/test.png",
"quotas": [
{
"id": "5da57fed5272cd0001d5b62c",
"key": "${merchantId}-${outletId}",
"value": 5000.0,
"description": "5000 bath use only for all promotion period",
"valueField": "purchaseAmount",
"campaign": {
"createdBy": "66958747575",
"createdDate": "2019-10-15T08:14:37.156Z",
"lastModifiedBy": "66958747575",
"lastModifiedDate": "2019-10-15T08:14:37.156Z",
"id": "5da57fed5272cd0001d5b62a",
"name": "WeMall 11/11",
"description": "WeMall 11/11",
"startDate": "2019-09-30T17:00:00Z",
"endDate": "2019-08-01T00:00:00Z",
"refCode": "WM00001",
"status": "ENABLE",
"channel": "WMAPP",
"imageUrl": "http://test.com/test.png",
"rules": [
{
"id": "96f9e0b5-2e90-4d6f-b2f4-416bd0783047",
"name": "Buy iPhone, Free Leather Case",
"description": "Buy iPhone, Free Leather Case",
"when": [
{
"match": "ALL",
"conditions": [
{
"type": "custom",
"attribute": "customerGrading",
"op": "eq",
"value": "diamond",
"valueType": "STRING",
"note": "",
"resolveAction": false
},
{
"type": "cartItem",
"attribute": "amount",
"op": "eq",
"value": "1.0",
"valueType": "NUMBER",
"note": "",
"resolveAction": false
},
{
"type": "cartItem",
"attribute": "sku",
"op": "eq",
"value": "IPHONE-2019",
"valueType": "STRING",
"note": "",
"resolveAction": false
},
{
"type": "cartItem",
"attribute": "tags",
"op": "contais",
"value": "apple",
"valueType": "STRING",
"note": "",
"resolveAction": false
}
]
}
],
"thenOperator": "AND",
"then": [
{
"action": "FREE_GIFT",
"internalAction": false,
"actionRef": "c1833667-a204-4a4c-8507-06d46dca59eb",
"data": [
{
"type": "custom",
"attribute": "sku",
"op": null,
"value": "IPHONE-2019-LEATHER-CASE",
"valueType": "STRING",
"note": "",
"resolveAction": false
},
{
"type": "custom",
"attribute": "amount",
"op": null,
"value": "1",
"valueType": "STRING",
"note": "",
"resolveAction": false
}
]
}
],
"validFrom": null,
"validTo": null,
"campaign": null
}
],
"projectId": "5d2ef2d0f085380001da6a5d",
"version": 0,
"active": true
},
"projectId": "5d2ef2d0f085380001da6a5d"
}
],
"rules": [
{
"id": "96f9e0b5-2e90-4d6f-b2f4-416bd0783047",
"name": "Buy iPhone, Free Leather Case",
"description": "Buy iPhone, Free Leather Case",
"when": [
{
"match": "ALL",
"conditions": [
{
"type": "custom",
"attribute": "customerGrading",
"op": "eq",
"value": "diamond",
"valueType": "STRING",
"note": "",
"resolveAction": false
},
{
"type": "cartItem",
"attribute": "amount",
"op": "eq",
"value": "1.0",
"valueType": "NUMBER",
"note": "",
"resolveAction": false
},
{
"type": "cartItem",
"attribute": "sku",
"op": "eq",
"value": "IPHONE-2019",
"valueType": "STRING",
"note": "",
"resolveAction": false
},
{
"type": "cartItem",
"attribute": "tags",
"op": "contais",
"value": "apple",
"valueType": "STRING",
"note": "",
"resolveAction": false
}
]
}
],
"thenOperator": "AND",
"then": [
{
"action": "FREE_GIFT",
"internalAction": false,
"actionRef": "c1833667-a204-4a4c-8507-06d46dca59eb",
"data": [
{
"type": "custom",
"attribute": "sku",
"op": null,
"value": "IPHONE-2019-LEATHER-CASE",
"valueType": "STRING",
"note": "",
"resolveAction": false
},
{
"type": "custom",
"attribute": "amount",
"op": null,
"value": "1",
"valueType": "STRING",
"note": "",
"resolveAction": false
}
]
}
],
"validFrom": null,
"validTo": null,
"campaign": null
}
],
"projectId": "5d2ef2d0f085380001da6a5d",
"version": 0,
"active": true
}
Response Error Example:
HTTP/1.1 400 Bad Request
Content-Type: application/json
{
"type": "https://www.jhipster.tech/problem/constraint-violation",
"title": "Method argument not valid",
"status": 400,
"path": "/api/projects/5d2ef2d0f085380001da6a5d/campaigns",
"message": "error.validation",
"fieldErrors": [
{
"objectName": "campaign",
"field": "startDate",
"message": "NotNull"
}
]
}
HTTP/1.1 400 Bad Request
Content-Type: application/json
{
"type": "https://www.jhipster.tech/problem/problem-with-message",
"status": 400,
"path": "/api/projects/5d2ef2d0f085380001da6a5d/campaigns",
"violations": [
{
"field": "refCode",
"message": "Duplicate refCode"
}
],
"message": "error.validation"
}
HTTP/1.1 400 Bad Request
Content-Type: application/json
{
"entityName": "campaign",
"errorKey": "idexists",
"type": "https://www.jhipster.tech/problem/problem-with-message",
"title": "A new campaign cannot already have an ID",
"status": 400,
"message": "error.idexists",
"params": "campaign"
}
# Update Campaign
Method: PUT
Path: /promotion/api/project/{projectId}/campaigns
Description: Update a campaign based on the project id
- Scope:
- camp.camp.w
Examples Postman collection: Campaign-filter collection
Request Header:
Param | Description | Required | Examle |
---|---|---|---|
Authorization | The OAuth2 authentication with the O2O System | Y | Bearer {O2O Access Token} |
Content-Type | The MIME type of this content | Y | application/json |
Request Parameters:
Param | Description | Required | Example |
---|---|---|---|
ignoreReload | The flag that indicate if the campaign will be loaded to rule engine or not | N | /promotion/api/project/{projectId}/campaigns?ignoreReload=true |
Request Body:
Field | Description | Type | Required | Default | Format | Note |
---|---|---|---|---|---|---|
id | Id of the campaign | String | Y | |||
name | Name of the campaign | String | N | |||
groupName | Group Name of the campaign | String | N | |||
description | Description of the campaign | String | N | |||
channel | Channel of the campaign | String | N | |||
imageUrl | Url uploaded image of the campaign | String | N | |||
refCode | Campaign code of the campaign | String | Y | Value is not empty string | ||
startDate | Start date of the campaign | String | Y | YYYY-MM-DDTHH:mm:ssZ | Value must be set before end date | |
endDate | End date of the campaign | String | N | YYYY-MM-DDTHH:mm:ssZ | Value must be set after start date | |
rules | Rules of the campaign | List of Rule object | N | |||
rules[*].name | Name of rule | String | Y | Value is not empty string | ||
rules[*].description | Description of rule | String | N | |||
rules[*].when | Condition group for redeem campaign of rule | List of When object | N | |||
rules[*].when[*].match | Field information of each when for define when can redeem by match all conditions or match some conditions | String | N | Now, Value can be set with "ALL" only | ||
rules[*].when[*].conditions | Conditions of when for redeem campaign | List of Condition object | N | |||
rules[*].when[*].conditions[*].type | Field information for categorization condition | String | N | Value can be set with "custom" or "cart" or "cartItem" only | ||
rules[*].when[*].conditions[*].attribute | Attribute name of condition | String | N | |||
rules[*].when[*].conditions[*].op | Operator for compare condition | String | N | Value can be set with "eq", "neq", "gt", "gte", "lt", "lte", "in", "not_in", "matches", "not_matches", "contains", "not_contains" only | ||
rules[*].when[*].conditions[*].value | Value of condition | String | Y | Value is not empty string | ||
rules[*].when[*].conditions[*].valueType | Type of value in condition | String | N | "STRING" | Value can be set with "STRING" or "cart" or "NUMBER" only | |
rules[*].when[*].conditions[*].note | Description of condition | String | N | |||
rules[*].thenOperator | Field information of rule for define rule can redeem by select action when value is "OR" | String | N | "AND" | Value can be set with "AND" or "OR" only | |
rules[*].then | Benefit action group of rule | List of Then object | N | |||
rules[*].then[*].action | Name of action | String | N | |||
rules[*].then[*].internalAction | Flag of action for define when redeem will call to other services | Boolean | N | false | ||
rules[*].then[*].data | Benefit group of action | List of Condition object | N | |||
rules[*].then[*].data[*].attribute | Field name of benefit | String | N | |||
rules[*].then[*].data[*].value | Value of benefit | String | Y | Value is not empty string | ||
rules[*].then[*].data[*].note | Description of benefit | String | N | |||
rules[*].then[*].data[*].resolveAction | Flag of benefit value for define value field can resolve by expressions | Boolean | N | false | ||
rules[*].quotas | Quota group for limitation campaign | List of Quota object | N | |||
rules[*].quotas[*].key | Key of quota for summarize limitation campaign | String | Y | ${fieldName1}-${fieldName2} | ||
rules[*].quotas[*].value | Value is limit value of quota | String | Y | |||
rules[*].quotas[*].valueField | Field name for get value from Field attribute in redemption request in order to summarize limitation campaign | String | N | |||
rules[*].quotas[*].description | Description of quota | String | N | |||
status | Status of the campaign | String | N | Value can be set "ENABLE" or "DISABLE" only | ||
version | Version of the campaign for check optimistic locking | Integer | N | 0 |
Request Body Example:
{
"id": "5da688fcb2392900010e1772",
"name": "WeMall 11/11",
"groupName": "WeMall",
"description": "WeMall 11/11",
"refCode": "WM00001",
"channel": "WMAPP",
"imageUrl": "http://test.com/test.png",
"status": "ENABLE",
"startDate": "1998-05-08T15:53:00Z",
"endDate": "2019-08-01T00:00:00Z",
"rules": [
{
"name": "Buy iPhone, Free Leather Case",
"description": "Buy iPhone, Free Leather Case",
"when": [
{
"match": "ALL",
"conditions": [
{
"type": "custom",
"attribute": "customerGrading",
"op": "eq",
"value": "diamond",
"valueType": "STRING",
"note": ""
},
{
"type": "cartItem",
"attribute": "sku",
"op": "eq",
"value": "IPHONE-2019",
"valueType": "STRING",
"note": ""
},
{
"type": "cartItem",
"attribute": "tags",
"op": "contains",
"value": "apple",
"valueType": "STRING",
"note": ""
},
{
"type": "cartItem",
"attribute": "amount",
"op": "eq",
"value": "1"
"valueType": "NUMBER",
"note": ""
}
]
}
],
"then": [
{
"action": "FREE_GIFT",
"data": [
{
"attribute": "sku",
"value": "IPHONE-2019-LEATHER-CASE",
"note": ""
},
{
"attribute": "amount",
"value": "1",
"note": ""
}
]
}
]
}
],
"quotas": [
{
"valueField": "purchaseAmount",
"key": "${merchantId}-${outletId}",
"value": 5000,
"description": "5000 bath use only for all promotion period"
}
]
}
Request Example:
curl -X POST \
https://alpha-platform.weomni-test.com/promotion/api/projects/5d2ef2d0f085380001da6a5d/campaigns \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {O2O Access Token}' \
-d '{
"id": "5da688fcb2392900010e1772",
"name": "WeMall 11/11",
"groupName": "WeMall",
"description": "WeMall 11/11",
"startDate": "1998-05-08T15:53:00Z",
"endDate": "2019-08-01T00:00:00Z",
"refCode": "WM00001",
"status": "ENABLE",
"channel": "WMAPP",
"imageUrl": "http://test.com/test.png",
"quotas": [
{
"value": "5000",
"key": "${merchantId}-${outletId}",
"valueField": "purchaseAmount",
"description": "5000 bath use only for all promotion period"
}
],
"rules": [
{
"name": "Buy iPhone, Free Leather Case",
"description": "Buy iPhone, Free Leather Case",
"when": [
{
"match": "ALL",
"conditions": [
{
"type": "custom",
"attribute": "customerGrading",
"op": "eq",
"value": "diamond",
"valueType": "STRING",
"note": ""
},
{
"type": "cartItem",
"attribute": "amount",
"op": "eq",
"value": "1",
"valueType": "NUMBER",
"note": ""
},
{
"type": "cartItem",
"attribute": "sku",
"op": "eq",
"value": "IPHONE-2019",
"valueType": "STRING",
"note": ""
},
{
"type": "cartItem",
"attribute": "tags",
"op": "contais",
"value": "apple",
"valueType": "STRING",
"note": ""
}
]
}
],
"thenOperator": "AND",
"then": [
{
"data": [
{
"type": "custom",
"attribute": "sku",
"value": "IPHONE-2019-LEATHER-CASE",
"valueType": "STRING"
},
{
"type": "custom",
"attribute": "amount",
"value": "1",
"valueType": "STRING"
}
]
}
]
}
],
"version": 0
}'
Response Codes:
HTTP Status Code | Description | Message |
---|---|---|
200 | Update campaign successfully | |
400 | Update campaign with id is null | error.idnull |
400 | Update campaign with duplicated ref code | Duplicate refCode |
400 | Update campaign with duplicated rule name | Duplicated rule name: ${ruleName} |
400 | Update campaign with missing required field | NotNull, NotBlank |
400 | Update campaign with date time incorrect format | JSON parse error: Cannot deserialize value of type java.time.ZonedDateTime |
400 | Update campaign with start date after end date | Method argument not valid |
400 | Update campaign with incorrect format condition attributes | ValidConditionAttributeValue |
400 | Update campaign with valueType NUMBER but value is in incorrect format | JSON parse error: The attribute value is not a number (valueType = NUMBER) |
400 | Update campaign with valueType STRING but value is empty or null | NotBlankString |
401 | Unauthorized | |
403 | Forbidden | |
409 | Conflict | |
500 | Internal Server Error |
Response Success Example:
HTTP/1.1 200 Ok
Content-Type: application/json
{
"createdBy": "66958747575",
"createdDate": "2019-10-15T08:14:37.156Z",
"lastModifiedBy": "66958747575",
"lastModifiedDate": "2019-10-15T08:14:37.156Z",
"id": "5da688fcb2392900010e1772",
"name": "WeMall 11/11",
"groupName": "WeMall",
"description": "WeMall 11/11",
"startDate": "1998-05-08T15:53:00Z",
"endDate": "2019-08-01T00:00:00Z",
"refCode": "WM00001",
"status": "ENABLE",
"channel": "WMAPP",
"imageUrl": "http://test.com/test.png",
"quotas": [
{
"id": "5da57fed5272cd0001d5b62c",
"key": "${merchantId}-${outletId}",
"value": 5000.0,
"description": "5000 bath use only for all promotion period",
"valueField": "purchaseAmount",
"campaign": {
"createdBy": "66958747575",
"createdDate": "2019-10-15T08:14:37.156Z",
"lastModifiedBy": "66958747575",
"lastModifiedDate": "2019-10-15T08:14:37.156Z",
"id": "5da57fed5272cd0001d5b62a",
"name": "WeMall 11/11",
"description": "WeMall 11/11",
"startDate": "2019-09-30T17:00:00Z",
"endDate": "2019-08-01T00:00:00Z",
"refCode": "WM00001",
"status": "ENABLE",
"channel": "WMAPP",
"imageUrl": "http://test.com/test.png",
"rules": [
{
"id": "96f9e0b5-2e90-4d6f-b2f4-416bd0783047",
"name": "Buy iPhone, Free Leather Case",
"description": "Buy iPhone, Free Leather Case",
"when": [
{
"match": "ALL",
"conditions": [
{
"type": "custom",
"attribute": "customerGrading",
"op": "eq",
"value": "diamond",
"valueType": "STRING",
"note": "",
"resolveAction": false
},
{
"type": "cartItem",
"attribute": "amount",
"op": "eq",
"value": "1.0",
"valueType": "NUMBER",
"note": "",
"resolveAction": false
},
{
"type": "cartItem",
"attribute": "sku",
"op": "eq",
"value": "IPHONE-2019",
"valueType": "STRING",
"note": "",
"resolveAction": false
},
{
"type": "cartItem",
"attribute": "tags",
"op": "contais",
"value": "apple",
"valueType": "STRING",
"note": "",
"resolveAction": false
}
]
}
],
"thenOperator": "AND",
"then": [
{
"action": "FREE_GIFT",
"internalAction": false,
"actionRef": "c1833667-a204-4a4c-8507-06d46dca59eb",
"data": [
{
"type": "custom",
"attribute": "sku",
"op": null,
"value": "IPHONE-2019-LEATHER-CASE",
"valueType": "STRING",
"note": "",
"resolveAction": false
},
{
"type": "custom",
"attribute": "amount",
"op": null,
"value": "1",
"valueType": "STRING",
"note": "",
"resolveAction": false
}
]
}
],
"validFrom": null,
"validTo": null,
"campaign": null
}
],
"projectId": "5d2ef2d0f085380001da6a5d",
"version": 0,
"active": true
},
"projectId": "5d2ef2d0f085380001da6a5d"
}
],
"rules": [
{
"id": "96f9e0b5-2e90-4d6f-b2f4-416bd0783047",
"name": "Buy iPhone, Free Leather Case",
"description": "Buy iPhone, Free Leather Case",
"when": [
{
"match": "ALL",
"conditions": [
{
"type": "custom",
"attribute": "customerGrading",
"op": "eq",
"value": "diamond",
"valueType": "STRING",
"note": "",
"resolveAction": false
},
{
"type": "cartItem",
"attribute": "amount",
"op": "eq",
"value": "1.0",
"valueType": "NUMBER",
"note": "",
"resolveAction": false
},
{
"type": "cartItem",
"attribute": "sku",
"op": "eq",
"value": "IPHONE-2019",
"valueType": "STRING",
"note": "",
"resolveAction": false
},
{
"type": "cartItem",
"attribute": "tags",
"op": "contais",
"value": "apple",
"valueType": "STRING",
"note": "",
"resolveAction": false
}
]
}
],
"thenOperator": "AND",
"then": [
{
"action": "FREE_GIFT",
"internalAction": false,
"actionRef": "c1833667-a204-4a4c-8507-06d46dca59eb",
"data": [
{
"type": "custom",
"attribute": "sku",
"op": null,
"value": "IPHONE-2019-LEATHER-CASE",
"valueType": "STRING",
"note": "",
"resolveAction": false
},
{
"type": "custom",
"attribute": "amount",
"op": null,
"value": "1",
"valueType": "STRING",
"note": "",
"resolveAction": false
}
]
}
],
"validFrom": null,
"validTo": null,
"campaign": null
}
],
"projectId": "5d2ef2d0f085380001da6a5d",
"version": 0,
"active": true
}
Response Error Example:
HTTP/1.1 400 Bad Request
Content-Type: application/json
{
"type": "https://www.jhipster.tech/problem/constraint-violation",
"title": "Method argument not valid",
"status": 400,
"path": "/api/projects/5d2ef2d0f085380001da6a5d/campaigns",
"message": "error.validation",
"fieldErrors": [
{
"objectName": "campaign",
"field": "startDate",
"message": "NotNull"
}
]
}
HTTP/1.1 400 Bad Request
Content-Type: application/json
{
"type": "https://www.jhipster.tech/problem/problem-with-message",
"status": 400,
"path": "/api/projects/5d2ef2d0f085380001da6a5d/campaigns",
"violations": [
{
"field": "refCode",
"message": "Duplicate refCode"
}
],
"message": "error.validation"
}
HTTP/1.1 400 Bad Request
Content-Type: application/json
{
"entityName": "campaign",
"errorKey": "idexists",
"type": "https://www.jhipster.tech/problem/problem-with-message",
"title": "A new campaign cannot already have an ID",
"status": 400,
"message": "error.idexists",
"params": "campaign"
}
# Reload Campaigns by group name
Method: POST
Path: /promotion/api/projects/{projectId}/campaigns/group/{groupName}/reload
Description: Reload campaigns in the specific group name
- Scope:
- camp.reload-group
Request Header:
Param | Description | Required | Examle |
---|---|---|---|
Authorization | The OAuth2 authentication with the O2O System | Y | Bearer {O2O Access Token} |
Content-Type | The MIME type of this content | Y | application/json |
# Create BulkCampaign
Method: POST
Path: /promotion/api/project/{projectId}//campaigns-bulk
Description: Create a bulk of campaign based on the project id
- Scope:
- camp.camp.w
Request Header:
Param | Description | Required | Examle |
---|---|---|---|
Authorization | The OAuth2 authentication with the O2O System | Y | Bearer {O2O Access Token} |
Content-Type | The MIME type of this content | Y | application/json |
Request Body:
[
...List of campaigns
]