Get campaigns

Shop API v1
GET*base*/campaigns
GET*base*/campaigns/*campaignId*
Authentication:API key

Fetches a specific campaign referenced by its ID, or the full campaigns list.

If the campaignId parameter is specified, one campaign is fetched, otherwise all campaigns are fetched.

Parameters

campaignId

int
optional
Campaign ID as integer.

Response

200 Content-type: application/json

object key

brand object
required

The campaignId for the campaign object.

"15": {"name": "Campaign X"} for campaign ID 15.

name

string
The name of the campaign.

campaign

string
The ID of the campaign.

markets

object

A list of markets enabled for this campaign. The key values in the list are the market IDs.

"markets": {"16": {...}} means an object for market ID 16.

pricelists

object

A list of pricelists in the market activated in this campaign. The key values in the list are the pricelist IDs.

"pricelists": {"17": {...}} means an object for pricelist ID 17.

productsOnSale

array

An array with productIds currently in the campaign.

"20": {"productsOnSale": ["123", "124"]} means the products with ID 123 and 124 is in a campaign for pricelist ID 20.

Response example

Fetching a list of campaigns:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
HTTP/1.1 200 OK
Content-type: application/json

{
  "5": {
     "name" : "Outlet",
     "campaign" : "5",
     "markets" : {
        "16" : {
           "pricelists" : {
              "47" : {
                 "productsOnSale" : [
                    "2194",
                    "2172",
                    "1639",
                 ]
              }
           }
        }
     }
  }
}

Fetching a specific campaign using campaignId:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
HTTP/1.1 200 OK
Content-type: application/json

{
   "name" : "Outlet",
   "campaign" : "5",
   "markets" : {
      "16" : {
         "pricelists" : {
            "47" : {
               "productsOnSale" : [
                  "2194",
                  "2172",
                  "1639",
               ]
            }
         }
      }
   }
}

Error example

1
2
3
4
5
6
7
8
HTTP/1.1 404 Not Found
Content-type: application/json

{
    "errors" : {
       "campaign" : "not found"
    }
 }