PromotionSearch resource (Data API 23.2)
Summary
Http Method | Resource | Description |
---|---|---|
POST | /sites/{site_id}/promotion_search |
Searches for promotions. The SearchRequest document contains a search object that allows filtering on various attributes. The query attribute specifies a complex query that can be used to narrow down the search. These are the searchable attributes:
Note that only searchable attributes can be used in sorting. Additionally, the following attribute can be used to sort:
|
Search Promotions
Searches for promotions.
The SearchRequest document contains a search object that allows filtering on various attributes.
The query attribute specifies a complex query that can be used to narrow down the search. These are the searchable attributes:
- id - String
- name - String
- currency_code - String
- exclusivity - String
- enabled - Boolean
Note that only searchable attributes can be used in sorting. Additionally, the following attribute can be used to sort:
- promotion_class - String
Url
POST https://hostname:port/dw/data/v23_2/sites/{site_id}/promotion_search
Formats
json, xml
Authentication
Name | Description |
---|---|
OAuth | Authentication via OAuth token. |
Request Document
Response Document
Path Parameters
Parameter | Type | Description | Constraints |
---|---|---|---|
site_id | String | The site context. |
In case of a failure Fault Document is returned.
Faults
Status | Type | Arguments | Description |
---|---|---|---|
400 | MalformedSearchParameterException |
Thrown if the query is ill-formed. |
Sample
REQUEST:
POST /s/-/dw/data/v23_2/sites/SiteGenesis/promotion_search HTTP/1.1
Host: example.com
Authorization: Bearer a5b6eb0d-8312-41a3-88f3-2c53c4507367
Accept: application/json
{
"query" :
{
"text_query" :
{
"fields" :
[
"name"
],
"search_phrase" : "*coupon*"
}
},
"select" : "(**)"
}
RESPONSE:
HTTP/1.1 200 OK
Content-Length: 67
Content-Type: application/json; charset=UTF-8
{
"_v" : "23.2",
"_type" : "promotion_search_result",
"count" : 1,
"hits" :
[
{
"_type" : "promotion",
"_resource_state":"c2309jd239jdrifj3ui4fn",
"assignment_information" :
{
"_type" : "promotion_assignment_information",
"active" : true,
"active_campaign_assignments" :
[
{
"_type" : "promotion_campaign_assignment",
"campaign_id" : "coupon-campaign",
"coupons" :
[
"limitPerCode-coupon",
"multipleCodes-coupon",
"longCode-coupon",
"systemCodes-coupon",
"limitPerTimePeriod-coupon",
"disabled-coupon",
"singleCode-coupon",
"limitPerCustomer-coupon"
],
"description" : "Coupon Promotion",
"link" : "https://example.com/s/-/dw/data/v23_2/sites/SiteGenesis/promotion_campaign_assignments/coupon-promotion/coupon-campaign",
"promotion_id" : "coupon-promotion",
"rank" : 10,
"schedule" :
{
"_type" : "schedule"
}
}
],
"campaign_id" : "coupon-campaign",
"end_date" : "2050-06-01T00:00:00.000Z",
"schedule" :
{
"_type" : "schedule"
},
"schedule_type" : "campaign",
"start_date" : "2020-05-01T00:00:00.000Z"
},
"disable_globally_excluded" : false,
"enabled" : true,
"exclusivity" : "no",
"id" : "coupon-promotion",
"link" : "https://example.com/s/-/dw/data/v23_2/sites/SiteGenesis/promotions/coupon-promotion",
"name" :
{
"default" : "Coupon Promotion"
},
"promotion_class" : "product"
}
],
"query" :
{
"text_query" :
{
"_type" : "text_query",
"fields" :
[
"name"
],
"search_phrase" : "*coupon*"
}
},
"select" : "(**)",
"sorts" :
[
{
"_type" : "sort",
"field" : "id",
"sort_order" : "asc"
}
],
"start" : 0,
"total" : 1
}