Promotions Resource (Shop API 14.6)

Summary

Http Method Resource Description
GET /Promotions Handles get promotion by filter criteria Returns an array of enabled promotions matching specified filter criteria. In the request URL, you must provide a campaign_id parameter, and you can optionally specify a date range by providing start_date and end_date parameters. Both parameters are required to specify a date range: omitting one causes the server to return a MissingParameterException fault. Each request returns only enabled promotions; the server does not consider promotion qualifiers or schedules.
GET /Promotions/({Id},...,{Id}) Returns an array of enabled promotions for a list of specified ids. In the request URL, you can specify up to 50 ids. You must enclose the list of ids in parentheses. If you specify an id that contains either parentheses or the separator characters, you must URL encode these characters. Each request returns only enabled promotions; the server does not consider promotion qualifiers or schedules.
GET /Promotions/{Id} Returns an enabled promotion using a specified id. Each request returns a response only for an enabled promotion; the server does not consider promotion qualifiers or schedules.

Get Multiple Promotions by Filter Criteria

Handles get promotion by filter criteria Returns an array of enabled promotions matching specified filter criteria. In the request URL, you must provide a campaign_id parameter, and you can optionally specify a date range by providing start_date and end_date parameters. Both parameters are required to specify a date range: omitting one causes the server to return a MissingParameterException fault. Each request returns only enabled promotions; the server does not consider promotion qualifiers or schedules.

Url

GET http://hostname:port/dw/shop/v14_6/promotions?campaign_id={String}&start_date={String}&end_date={String}

Formats

json, xml

Authentication

Name Description
None No authentication.

Response Document

PromotionResult

Query Parameters

Parameter Type Description Constraints
campaign_id String Find the promotions assigned to this campaign (mandatory) mandatory=true, maxLength=256, minLength=1, nullable=false
end_date String The end date of the promotion in ISO8601 date time format: yyyy-MM-dd'T'HH:mmZ  
start_date String The start date of the promotion in ISO8601 date time format: yyyy-MM-dd'T'HH:mmZ  

In case of a failure Fault Document is returned.

Faults

Status Type Arguments Description
400 MissingEndDateException   Thrown when a start date, but no end date was given
400 MissingStartDateException   Thrown when an end date but no start date was given
400 EndDateBeforeStartException   Thrown when the given end date is before the given start date

Sample

REQUEST:
GET /dw/shop/v14_6/promotions?campaign_id=test-campaign&start_date=2010-06-01T00:00Z&end_date=2011-06-01T00:00Z HTTP/1.1
Host: example.com
Accept: application/json
 
RESPONSE:
HTTP/1.1 200 OK
Content-Length: 67
Content-Type: application/json; charset=UTF-8
Cache-Control: max-age=900,must-revalidate
{
  "_v": "14.6",
  "count": 2,
  "total": 2,
  "data":
  [{
    "id": "15off-gps",
    "name": "GPS 15% Off",
    "callout_msg": "15% Off GPS Unit With Coupon",
    "details": "15% Off GPS Unit With Coupon with a coupon.",
    "image": "",
    "start_date" : "2010-06-01T00:00Z",
    "end_date" : "2020-06-01T00:00Z"
  },
  {
    "id": "20off-tvs",
    "name": "20% Off select TVs",
    "callout_msg": "20% Off select TVs",
    "details": "20% Off TVs, selected models only for this promotion. Limit 1 television per order",
    "image": "",
    "start_date" : "2010-06-01T00:00Z",
    "end_date" : "2020-06-01T00:00Z",
    "discounted_products_link" : "http://example.com/dw/shop/v14_6/product_search?pretty_print=true&client_id=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&refine=pmid=20off-tvs"
  }]
}

Get Multiple Promotions by Id

Returns an array of enabled promotions for a list of specified ids. In the request URL, you can specify up to 50 ids. You must enclose the list of ids in parentheses. If you specify an id that contains either parentheses or the separator characters, you must URL encode these characters. Each request returns only enabled promotions; the server does not consider promotion qualifiers or schedules.

Url

GET http://hostname:port/dw/shop/v14_6/promotions/({id},...,{id})?locale={String}

Formats

json, xml

Authentication

Name Description
None No authentication.

Response Document

PromotionResult

Path Parameters

Parameter Type Description Constraints
ids [String] The ids of the requested promotions. maxItems=50, maxLength=256

Query Parameters

Parameter Type Description Constraints
locale String The locale context.  

Sample

REQUEST:
GET /dw/shop/v14_6/promotions/(15off-gps,20off-tvs) HTTP/1.1
Host: example.com
Accept: application/json

RESPONSE:
HTTP/1.1 200 OK
Content-Length: 67
Content-Type: application/json; charset=UTF-8
Cache-Control: max-age=900,must-revalidate
{
  "_v":"14.6",
  "count":2,
  "total":2,
  "data":
  [{
    "id":"15off-gps",
    "name":"GPS 15% Off",
    "callout_msg":"15% Off GPS Unit With Coupon",
    "details":"15% Off GPS Unit With Coupon with a coupon.",
    "image":"",
    "start_date" : "2010-06-01T00:00Z",
    "end_date" : "2020-06-01T00:00Z"
  },
  {
    "id":"20off-tvs",
    "name":"20% Off select TVs",
    "callout_msg":"20% Off select TVs",
    "details":"20% Off TVs, selected models only for this promotion. Limit 1 television per order",
    "image":"",
    "start_date" : "2010-06-01T00:00Z",
    "end_date" : "2020-06-01T00:00Z",
    "discounted_products_link" : "http://example.com/dw/shop/v14_6/product_search?pretty_print=true&client_id=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&refine=pmid=20off-tvs"
  }]
}

Get Promotion

Returns an enabled promotion using a specified id. Each request returns a response only for an enabled promotion; the server does not consider promotion qualifiers or schedules.

Url

GET http://hostname:port/dw/shop/v14_6/promotions/{id}?locale={String}

Formats

json, xml

Authentication

Name Description
None No authentication.

Response Document

Promotion

Path Parameters

Parameter Type Description Constraints
id String The id of the requested promotion. maxLength=256

Query Parameters

Parameter Type Description Constraints
locale String The locale context.  

In case of a failure Fault Document is returned.

Faults

Status Type Arguments Description
404 NotFoundException   Thrown when there is no promotion existing with the given ID for the requested site

Sample

REQUEST:
GET /dw/shop/v14_6/promotions/15off-gps HTTP/1.1
Host: example.com
Accept: application/json

RESPONSE:
HTTP/1.1 200 OK
Content-Length: 67
Content-Type: application/json; charset=UTF-8
Cache-Control: max-age=900,must-revalidate
{
  "_v":"14.6",
  "id":"15off-gps",
  "name":"GPS 15% Off",
  "callout_message":"15% Off GPS Unit With Coupon",
  "details":"15% Off GPS Unit With Coupon with a coupon.",
  "image":"",
  "start_date" : "2010-06-01T00:00Z",
  "end_date" : "2020-06-01T00:00Z"
}