> This page is for API Reference.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://fiftytwo-demo.ferndocs.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://fiftytwo-demo.ferndocs.com/_mcp/server.

# Insert/update list of campaigns for all stores

POST https://api.fiftytwo.com/masterdata/campaigns/v1/chain/{chain}
Content-Type: application/json

Only supported when master data is distributed by the 52ViKING enterprise service.

Reference: https://fiftytwo-demo.ferndocs.com/api/master-data/reference/campaigns/ecag

## Request

### Path parameters

- `chain` (integer, required) — The ID of the chain

### Body (application/json)

This endpoint expects a campaigns.

- `campaigns` (list of CampaignsCampaignsItems, required)

## Response

### 202

Accepted

## Errors

### 400 Bad Request Error

Bad Request

- `string`

## Types

### CampaignsCampaignsItems

- `campaignId` (integer, required) — The ID of the campaign.
- `campaignStart` (datetime, optional) — Start date-time of the campaign in ISO8601 format.
- `campaignStop` (datetime, optional) — End date-time of the campaign in ISO8601 format.
- `campaignType` (integer, optional) — Used for prioritizing campaigns. By default, the campaign that gets the customer the best deal is prioritized. Also used for summing up discounts per campaignType in built-in revenue analyses.\<p>Any change of prioritization scheme from the default must be set up. Ask your Fiftytwo consultant.\<p>
- `description` (string, optional) — Description of the campaign.
- `storeGroup` (string, optional) — Controls distribution of the campaign to a specific store or a group of stores when using Enterprise service distribution. Store groups are managed via the StoreGroup endpoint. \<p>To apply the campaign to all stores, leave this field blank ("").\<p>To target a single store, enter its store ID.\<p>To apply the campaign to a store group, enter a short group name (up to 4 characters) that does not start with the letter 'A' or 'a'.\<p>This field must follow the pattern: ^$|^[^aA].{0,3}$
- `campaignFamilies` (list of CampaignsCampaignsItemsCampaignFamiliesItems, optional) — You can add individual articles as well as discount familes (also known as article families, see the ArticleFamiles endpoint) to campaigns. This group of settings concerns discount familes and forms a list of discountfamilies and their discounts, requirements, etc. to include in the campaign. You can add a discount family to a campaign in order to give the discount family a certain discount when it's used in the campaign, but the discount family itself typically also has its own discount defined. Which discount will customers then get? If multiple discounts apply, 52ViKING always attempts to make sure that customers get the best deal. A discount family (created with articleFamily service) with same family ID as the campaign family ID must be present with off-campaign settings. That is, if the discount family is normally without discounts, it must be created without discounts.
- `campaignArticles` (list of CampaignsCampaignsItemsCampaignArticlesItems, optional) — You can add individual articles as well as discount familes to campaigns. This group of settings concerns individual articles and forms a list of articles and their discounts, requirements, etc. to include in the campaign.

### CampaignsCampaignsItemsCampaignFamiliesItems

- `campaignFamilyId` (integer, required) — The ID of the required discount family.
- `description` (string, optional) — Description of the discountfamily.
- `campaignFamilyDiscount` (list of CampaignsCampaignsItemsCampaignFamiliesItemsCampaignFamilyDiscountItems, optional) — With a discount family you can create discount ladders (also known as discount chains) with prices based on purchases of different quantities. Example: Two for EUR 20, three for EUR 29, five for EUR 40. This group of settings defines the required steps in the aricle family's discount ladder (a discount ladder can have from one to five steps.
- `discountCode` (integer, optional) — Defines the meaning of the amount field in the CampaignFamilyDiscount ladder. See description of discountCode in the articleFamilies endpoint.
- `discountInSets` (enum, optional) — See description of articleFamilies endpoint.
  - Allowed values: `0`, `1`
- `discountMaximum` (integer, optional) — See description of articleFamilies endpoint.
- `clubId` (integer, optional) — See description of articleFamilies endpoint.
- `campaignType` (integer, optional) — Used for prioritizing campaigns at the family level. By default, the campaign that gets the customer the best deal is prioritized. Also used for summing up discounts per campaignType in built-in revenue analyses.\<p>Change of prioritization scheme from the default must be set up.\<p>

### CampaignsCampaignsItemsCampaignArticlesItems

- `campaignArticleId` (integer, required) — Reference to an article. If the same campaignArticleId occurs in multiple ongoing campaigns, price information from the campaign with the lowest campaign number will apply, and sales figures will only be summed up on that campaign.
- `costPrice` (double, optional) — See description of articles endpoint.
- `price` (double, optional) — See description of articles endpoint.
- `articleFamilyId` (integer, optional) — See description of articles endpoint.
- `discountCode` (integer, optional) — ee description of articles endpoint.
- `discountQuantity` (integer, optional) — See description of articles endpoint.
- `discountAmount` (double, optional) — See description of articles endpoint.
- `discountPercentage` (integer, optional) — See description of articles endpoint.
- `discountInSets` (enum, optional) — See description of articles endpoint.
  - Allowed values: `0`, `1`
- `discountMaximum` (integer, optional) — See description of articles endpoint.
- `clubId` (integer, optional) — See description of articles endpoint.
- `campaignType` (integer, optional) — Used for prioritizing campaigns at article level. By default, the campaign that gets the customer the best deal is prioritized. Also used for summing up discounts per campaignType in built-in revenue analyses.\<p>Change of prioritization scheme from the default must be set up.\<p>

### CampaignsCampaignsItemsCampaignFamiliesItemsCampaignFamilyDiscountItems

- `quantity` (integer, optional) — Quantity of articles that customer is required to buy for each step in the discount ladder.
- `amount` (double, optional) — See description of discountCode in the articleFamilies endpoint.

## Examples

**Request**

```json
{
  "campaigns": [
    {
      "campaignId": 1123168,
      "campaignStart": "2017-06-28T22:00:00+00:00",
      "campaignStop": "2027-06-29T21:59:59+00:00",
      "campaignType": 1,
      "description": "Test campaign",
      "storeGroup": "PQRS",
      "campaignFamilies": [
        {
          "campaignFamilyId": 123,
          "description": "campaign family 123",
          "campaignFamilyDiscount": [
            {
              "quantity": 1,
              "amount": 16
            },
            {
              "quantity": 2,
              "amount": 8
            },
            {
              "quantity": 4,
              "amount": 4
            },
            {
              "quantity": 8,
              "amount": 2
            },
            {
              "quantity": 16,
              "amount": 1
            }
          ],
          "discountInSets": 1,
          "discountMaximum": 16
        },
        {
          "campaignFamilyId": 124,
          "description": "campaign family 124",
          "campaignFamilyDiscount": [
            {
              "quantity": 1,
              "amount": 16
            },
            {
              "quantity": 2,
              "amount": 8
            },
            {
              "quantity": 4,
              "amount": 4
            },
            {
              "quantity": 8,
              "amount": 2
            },
            {
              "quantity": 16,
              "amount": 1
            }
          ],
          "discountInSets": 1,
          "discountMaximum": 16
        }
      ],
      "campaignArticles": [
        {
          "campaignArticleId": 10083,
          "costPrice": 5,
          "price": 10,
          "articleFamilyId": 0,
          "discountCode": 1,
          "discountQuantity": 5,
          "discountAmount": 10,
          "discountPercentage": 0,
          "discountInSets": 1,
          "discountMaximum": 20,
          "clubId": 5
        },
        {
          "campaignArticleId": 100087,
          "costPrice": 20,
          "price": 30,
          "articleFamilyId": 0,
          "discountCode": 2,
          "discountQuantity": 1,
          "discountAmount": 5,
          "discountPercentage": 0,
          "discountInSets": 1,
          "discountMaximum": 20,
          "clubId": 5
        }
      ]
    }
  ]
}
```

**Response**

```json
{}
```

**SDK Code**

```python Campaigns_ECAG_example
import requests

url = "https://api.fiftytwo.com/masterdata/campaigns/v1/chain/1"

payload = { "campaigns": [
        {
            "campaignId": 1123168,
            "campaignStart": "2017-06-28T22:00:00+00:00",
            "campaignStop": "2027-06-29T21:59:59+00:00",
            "campaignType": 1,
            "description": "Test campaign",
            "storeGroup": "PQRS",
            "campaignFamilies": [
                {
                    "campaignFamilyId": 123,
                    "description": "campaign family 123",
                    "campaignFamilyDiscount": [
                        {
                            "quantity": 1,
                            "amount": 16
                        },
                        {
                            "quantity": 2,
                            "amount": 8
                        },
                        {
                            "quantity": 4,
                            "amount": 4
                        },
                        {
                            "quantity": 8,
                            "amount": 2
                        },
                        {
                            "quantity": 16,
                            "amount": 1
                        }
                    ],
                    "discountInSets": 1,
                    "discountMaximum": 16
                },
                {
                    "campaignFamilyId": 124,
                    "description": "campaign family 124",
                    "campaignFamilyDiscount": [
                        {
                            "quantity": 1,
                            "amount": 16
                        },
                        {
                            "quantity": 2,
                            "amount": 8
                        },
                        {
                            "quantity": 4,
                            "amount": 4
                        },
                        {
                            "quantity": 8,
                            "amount": 2
                        },
                        {
                            "quantity": 16,
                            "amount": 1
                        }
                    ],
                    "discountInSets": 1,
                    "discountMaximum": 16
                }
            ],
            "campaignArticles": [
                {
                    "campaignArticleId": 10083,
                    "costPrice": 5,
                    "price": 10,
                    "articleFamilyId": 0,
                    "discountCode": 1,
                    "discountQuantity": 5,
                    "discountAmount": 10,
                    "discountPercentage": 0,
                    "discountInSets": 1,
                    "discountMaximum": 20,
                    "clubId": 5
                },
                {
                    "campaignArticleId": 100087,
                    "costPrice": 20,
                    "price": 30,
                    "articleFamilyId": 0,
                    "discountCode": 2,
                    "discountQuantity": 1,
                    "discountAmount": 5,
                    "discountPercentage": 0,
                    "discountInSets": 1,
                    "discountMaximum": 20,
                    "clubId": 5
                }
            ]
        }
    ] }
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Campaigns_ECAG_example
const url = 'https://api.fiftytwo.com/masterdata/campaigns/v1/chain/1';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"campaigns":[{"campaignId":1123168,"campaignStart":"2017-06-28T22:00:00+00:00","campaignStop":"2027-06-29T21:59:59+00:00","campaignType":1,"description":"Test campaign","storeGroup":"PQRS","campaignFamilies":[{"campaignFamilyId":123,"description":"campaign family 123","campaignFamilyDiscount":[{"quantity":1,"amount":16},{"quantity":2,"amount":8},{"quantity":4,"amount":4},{"quantity":8,"amount":2},{"quantity":16,"amount":1}],"discountInSets":1,"discountMaximum":16},{"campaignFamilyId":124,"description":"campaign family 124","campaignFamilyDiscount":[{"quantity":1,"amount":16},{"quantity":2,"amount":8},{"quantity":4,"amount":4},{"quantity":8,"amount":2},{"quantity":16,"amount":1}],"discountInSets":1,"discountMaximum":16}],"campaignArticles":[{"campaignArticleId":10083,"costPrice":5,"price":10,"articleFamilyId":0,"discountCode":1,"discountQuantity":5,"discountAmount":10,"discountPercentage":0,"discountInSets":1,"discountMaximum":20,"clubId":5},{"campaignArticleId":100087,"costPrice":20,"price":30,"articleFamilyId":0,"discountCode":2,"discountQuantity":1,"discountAmount":5,"discountPercentage":0,"discountInSets":1,"discountMaximum":20,"clubId":5}]}]}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Campaigns_ECAG_example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.fiftytwo.com/masterdata/campaigns/v1/chain/1"

	payload := strings.NewReader("{\n  \"campaigns\": [\n    {\n      \"campaignId\": 1123168,\n      \"campaignStart\": \"2017-06-28T22:00:00+00:00\",\n      \"campaignStop\": \"2027-06-29T21:59:59+00:00\",\n      \"campaignType\": 1,\n      \"description\": \"Test campaign\",\n      \"storeGroup\": \"PQRS\",\n      \"campaignFamilies\": [\n        {\n          \"campaignFamilyId\": 123,\n          \"description\": \"campaign family 123\",\n          \"campaignFamilyDiscount\": [\n            {\n              \"quantity\": 1,\n              \"amount\": 16\n            },\n            {\n              \"quantity\": 2,\n              \"amount\": 8\n            },\n            {\n              \"quantity\": 4,\n              \"amount\": 4\n            },\n            {\n              \"quantity\": 8,\n              \"amount\": 2\n            },\n            {\n              \"quantity\": 16,\n              \"amount\": 1\n            }\n          ],\n          \"discountInSets\": 1,\n          \"discountMaximum\": 16\n        },\n        {\n          \"campaignFamilyId\": 124,\n          \"description\": \"campaign family 124\",\n          \"campaignFamilyDiscount\": [\n            {\n              \"quantity\": 1,\n              \"amount\": 16\n            },\n            {\n              \"quantity\": 2,\n              \"amount\": 8\n            },\n            {\n              \"quantity\": 4,\n              \"amount\": 4\n            },\n            {\n              \"quantity\": 8,\n              \"amount\": 2\n            },\n            {\n              \"quantity\": 16,\n              \"amount\": 1\n            }\n          ],\n          \"discountInSets\": 1,\n          \"discountMaximum\": 16\n        }\n      ],\n      \"campaignArticles\": [\n        {\n          \"campaignArticleId\": 10083,\n          \"costPrice\": 5,\n          \"price\": 10,\n          \"articleFamilyId\": 0,\n          \"discountCode\": 1,\n          \"discountQuantity\": 5,\n          \"discountAmount\": 10,\n          \"discountPercentage\": 0,\n          \"discountInSets\": 1,\n          \"discountMaximum\": 20,\n          \"clubId\": 5\n        },\n        {\n          \"campaignArticleId\": 100087,\n          \"costPrice\": 20,\n          \"price\": 30,\n          \"articleFamilyId\": 0,\n          \"discountCode\": 2,\n          \"discountQuantity\": 1,\n          \"discountAmount\": 5,\n          \"discountPercentage\": 0,\n          \"discountInSets\": 1,\n          \"discountMaximum\": 20,\n          \"clubId\": 5\n        }\n      ]\n    }\n  ]\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Campaigns_ECAG_example
require 'uri'
require 'net/http'

url = URI("https://api.fiftytwo.com/masterdata/campaigns/v1/chain/1")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"campaigns\": [\n    {\n      \"campaignId\": 1123168,\n      \"campaignStart\": \"2017-06-28T22:00:00+00:00\",\n      \"campaignStop\": \"2027-06-29T21:59:59+00:00\",\n      \"campaignType\": 1,\n      \"description\": \"Test campaign\",\n      \"storeGroup\": \"PQRS\",\n      \"campaignFamilies\": [\n        {\n          \"campaignFamilyId\": 123,\n          \"description\": \"campaign family 123\",\n          \"campaignFamilyDiscount\": [\n            {\n              \"quantity\": 1,\n              \"amount\": 16\n            },\n            {\n              \"quantity\": 2,\n              \"amount\": 8\n            },\n            {\n              \"quantity\": 4,\n              \"amount\": 4\n            },\n            {\n              \"quantity\": 8,\n              \"amount\": 2\n            },\n            {\n              \"quantity\": 16,\n              \"amount\": 1\n            }\n          ],\n          \"discountInSets\": 1,\n          \"discountMaximum\": 16\n        },\n        {\n          \"campaignFamilyId\": 124,\n          \"description\": \"campaign family 124\",\n          \"campaignFamilyDiscount\": [\n            {\n              \"quantity\": 1,\n              \"amount\": 16\n            },\n            {\n              \"quantity\": 2,\n              \"amount\": 8\n            },\n            {\n              \"quantity\": 4,\n              \"amount\": 4\n            },\n            {\n              \"quantity\": 8,\n              \"amount\": 2\n            },\n            {\n              \"quantity\": 16,\n              \"amount\": 1\n            }\n          ],\n          \"discountInSets\": 1,\n          \"discountMaximum\": 16\n        }\n      ],\n      \"campaignArticles\": [\n        {\n          \"campaignArticleId\": 10083,\n          \"costPrice\": 5,\n          \"price\": 10,\n          \"articleFamilyId\": 0,\n          \"discountCode\": 1,\n          \"discountQuantity\": 5,\n          \"discountAmount\": 10,\n          \"discountPercentage\": 0,\n          \"discountInSets\": 1,\n          \"discountMaximum\": 20,\n          \"clubId\": 5\n        },\n        {\n          \"campaignArticleId\": 100087,\n          \"costPrice\": 20,\n          \"price\": 30,\n          \"articleFamilyId\": 0,\n          \"discountCode\": 2,\n          \"discountQuantity\": 1,\n          \"discountAmount\": 5,\n          \"discountPercentage\": 0,\n          \"discountInSets\": 1,\n          \"discountMaximum\": 20,\n          \"clubId\": 5\n        }\n      ]\n    }\n  ]\n}"

response = http.request(request)
puts response.read_body
```

```java Campaigns_ECAG_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.fiftytwo.com/masterdata/campaigns/v1/chain/1")
  .header("Content-Type", "application/json")
  .body("{\n  \"campaigns\": [\n    {\n      \"campaignId\": 1123168,\n      \"campaignStart\": \"2017-06-28T22:00:00+00:00\",\n      \"campaignStop\": \"2027-06-29T21:59:59+00:00\",\n      \"campaignType\": 1,\n      \"description\": \"Test campaign\",\n      \"storeGroup\": \"PQRS\",\n      \"campaignFamilies\": [\n        {\n          \"campaignFamilyId\": 123,\n          \"description\": \"campaign family 123\",\n          \"campaignFamilyDiscount\": [\n            {\n              \"quantity\": 1,\n              \"amount\": 16\n            },\n            {\n              \"quantity\": 2,\n              \"amount\": 8\n            },\n            {\n              \"quantity\": 4,\n              \"amount\": 4\n            },\n            {\n              \"quantity\": 8,\n              \"amount\": 2\n            },\n            {\n              \"quantity\": 16,\n              \"amount\": 1\n            }\n          ],\n          \"discountInSets\": 1,\n          \"discountMaximum\": 16\n        },\n        {\n          \"campaignFamilyId\": 124,\n          \"description\": \"campaign family 124\",\n          \"campaignFamilyDiscount\": [\n            {\n              \"quantity\": 1,\n              \"amount\": 16\n            },\n            {\n              \"quantity\": 2,\n              \"amount\": 8\n            },\n            {\n              \"quantity\": 4,\n              \"amount\": 4\n            },\n            {\n              \"quantity\": 8,\n              \"amount\": 2\n            },\n            {\n              \"quantity\": 16,\n              \"amount\": 1\n            }\n          ],\n          \"discountInSets\": 1,\n          \"discountMaximum\": 16\n        }\n      ],\n      \"campaignArticles\": [\n        {\n          \"campaignArticleId\": 10083,\n          \"costPrice\": 5,\n          \"price\": 10,\n          \"articleFamilyId\": 0,\n          \"discountCode\": 1,\n          \"discountQuantity\": 5,\n          \"discountAmount\": 10,\n          \"discountPercentage\": 0,\n          \"discountInSets\": 1,\n          \"discountMaximum\": 20,\n          \"clubId\": 5\n        },\n        {\n          \"campaignArticleId\": 100087,\n          \"costPrice\": 20,\n          \"price\": 30,\n          \"articleFamilyId\": 0,\n          \"discountCode\": 2,\n          \"discountQuantity\": 1,\n          \"discountAmount\": 5,\n          \"discountPercentage\": 0,\n          \"discountInSets\": 1,\n          \"discountMaximum\": 20,\n          \"clubId\": 5\n        }\n      ]\n    }\n  ]\n}")
  .asString();
```

```php Campaigns_ECAG_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.fiftytwo.com/masterdata/campaigns/v1/chain/1', [
  'body' => '{
  "campaigns": [
    {
      "campaignId": 1123168,
      "campaignStart": "2017-06-28T22:00:00+00:00",
      "campaignStop": "2027-06-29T21:59:59+00:00",
      "campaignType": 1,
      "description": "Test campaign",
      "storeGroup": "PQRS",
      "campaignFamilies": [
        {
          "campaignFamilyId": 123,
          "description": "campaign family 123",
          "campaignFamilyDiscount": [
            {
              "quantity": 1,
              "amount": 16
            },
            {
              "quantity": 2,
              "amount": 8
            },
            {
              "quantity": 4,
              "amount": 4
            },
            {
              "quantity": 8,
              "amount": 2
            },
            {
              "quantity": 16,
              "amount": 1
            }
          ],
          "discountInSets": 1,
          "discountMaximum": 16
        },
        {
          "campaignFamilyId": 124,
          "description": "campaign family 124",
          "campaignFamilyDiscount": [
            {
              "quantity": 1,
              "amount": 16
            },
            {
              "quantity": 2,
              "amount": 8
            },
            {
              "quantity": 4,
              "amount": 4
            },
            {
              "quantity": 8,
              "amount": 2
            },
            {
              "quantity": 16,
              "amount": 1
            }
          ],
          "discountInSets": 1,
          "discountMaximum": 16
        }
      ],
      "campaignArticles": [
        {
          "campaignArticleId": 10083,
          "costPrice": 5,
          "price": 10,
          "articleFamilyId": 0,
          "discountCode": 1,
          "discountQuantity": 5,
          "discountAmount": 10,
          "discountPercentage": 0,
          "discountInSets": 1,
          "discountMaximum": 20,
          "clubId": 5
        },
        {
          "campaignArticleId": 100087,
          "costPrice": 20,
          "price": 30,
          "articleFamilyId": 0,
          "discountCode": 2,
          "discountQuantity": 1,
          "discountAmount": 5,
          "discountPercentage": 0,
          "discountInSets": 1,
          "discountMaximum": 20,
          "clubId": 5
        }
      ]
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Campaigns_ECAG_example
using RestSharp;

var client = new RestClient("https://api.fiftytwo.com/masterdata/campaigns/v1/chain/1");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"campaigns\": [\n    {\n      \"campaignId\": 1123168,\n      \"campaignStart\": \"2017-06-28T22:00:00+00:00\",\n      \"campaignStop\": \"2027-06-29T21:59:59+00:00\",\n      \"campaignType\": 1,\n      \"description\": \"Test campaign\",\n      \"storeGroup\": \"PQRS\",\n      \"campaignFamilies\": [\n        {\n          \"campaignFamilyId\": 123,\n          \"description\": \"campaign family 123\",\n          \"campaignFamilyDiscount\": [\n            {\n              \"quantity\": 1,\n              \"amount\": 16\n            },\n            {\n              \"quantity\": 2,\n              \"amount\": 8\n            },\n            {\n              \"quantity\": 4,\n              \"amount\": 4\n            },\n            {\n              \"quantity\": 8,\n              \"amount\": 2\n            },\n            {\n              \"quantity\": 16,\n              \"amount\": 1\n            }\n          ],\n          \"discountInSets\": 1,\n          \"discountMaximum\": 16\n        },\n        {\n          \"campaignFamilyId\": 124,\n          \"description\": \"campaign family 124\",\n          \"campaignFamilyDiscount\": [\n            {\n              \"quantity\": 1,\n              \"amount\": 16\n            },\n            {\n              \"quantity\": 2,\n              \"amount\": 8\n            },\n            {\n              \"quantity\": 4,\n              \"amount\": 4\n            },\n            {\n              \"quantity\": 8,\n              \"amount\": 2\n            },\n            {\n              \"quantity\": 16,\n              \"amount\": 1\n            }\n          ],\n          \"discountInSets\": 1,\n          \"discountMaximum\": 16\n        }\n      ],\n      \"campaignArticles\": [\n        {\n          \"campaignArticleId\": 10083,\n          \"costPrice\": 5,\n          \"price\": 10,\n          \"articleFamilyId\": 0,\n          \"discountCode\": 1,\n          \"discountQuantity\": 5,\n          \"discountAmount\": 10,\n          \"discountPercentage\": 0,\n          \"discountInSets\": 1,\n          \"discountMaximum\": 20,\n          \"clubId\": 5\n        },\n        {\n          \"campaignArticleId\": 100087,\n          \"costPrice\": 20,\n          \"price\": 30,\n          \"articleFamilyId\": 0,\n          \"discountCode\": 2,\n          \"discountQuantity\": 1,\n          \"discountAmount\": 5,\n          \"discountPercentage\": 0,\n          \"discountInSets\": 1,\n          \"discountMaximum\": 20,\n          \"clubId\": 5\n        }\n      ]\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Campaigns_ECAG_example
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = ["campaigns": [
    [
      "campaignId": 1123168,
      "campaignStart": "2017-06-28T22:00:00+00:00",
      "campaignStop": "2027-06-29T21:59:59+00:00",
      "campaignType": 1,
      "description": "Test campaign",
      "storeGroup": "PQRS",
      "campaignFamilies": [
        [
          "campaignFamilyId": 123,
          "description": "campaign family 123",
          "campaignFamilyDiscount": [
            [
              "quantity": 1,
              "amount": 16
            ],
            [
              "quantity": 2,
              "amount": 8
            ],
            [
              "quantity": 4,
              "amount": 4
            ],
            [
              "quantity": 8,
              "amount": 2
            ],
            [
              "quantity": 16,
              "amount": 1
            ]
          ],
          "discountInSets": 1,
          "discountMaximum": 16
        ],
        [
          "campaignFamilyId": 124,
          "description": "campaign family 124",
          "campaignFamilyDiscount": [
            [
              "quantity": 1,
              "amount": 16
            ],
            [
              "quantity": 2,
              "amount": 8
            ],
            [
              "quantity": 4,
              "amount": 4
            ],
            [
              "quantity": 8,
              "amount": 2
            ],
            [
              "quantity": 16,
              "amount": 1
            ]
          ],
          "discountInSets": 1,
          "discountMaximum": 16
        ]
      ],
      "campaignArticles": [
        [
          "campaignArticleId": 10083,
          "costPrice": 5,
          "price": 10,
          "articleFamilyId": 0,
          "discountCode": 1,
          "discountQuantity": 5,
          "discountAmount": 10,
          "discountPercentage": 0,
          "discountInSets": 1,
          "discountMaximum": 20,
          "clubId": 5
        ],
        [
          "campaignArticleId": 100087,
          "costPrice": 20,
          "price": 30,
          "articleFamilyId": 0,
          "discountCode": 2,
          "discountQuantity": 1,
          "discountAmount": 5,
          "discountPercentage": 0,
          "discountInSets": 1,
          "discountMaximum": 20,
          "clubId": 5
        ]
      ]
    ]
  ]] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.fiftytwo.com/masterdata/campaigns/v1/chain/1")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```