# Campaign

## Campaign list

<mark style="color:blue;">`GET`</mark> `https://partner-api.sddan.com/api/v1/public/event-notify/campaign`

Get campaign list

#### Query Parameters

| Name | Type   | Description                                 |
| ---- | ------ | ------------------------------------------- |
| size | number | number of maximum campaign returned by call |
| page | number |                                             |

#### Headers

| Name          | Type   | Description |
| ------------- | ------ | ----------- |
| Authorization | string | token       |

{% tabs %}
{% tab title="200 " %}

```
[
    {
      "id": "xxxxxxx-2feb-481a-9910-6d71dc337b00",
      "id_audience": "xxxxxx-6e58-4db7-8ada-53b7bace6da4",
      "id_partner": 12345,
      "name": "My first campaign",
      "notify_method": "WEBHOOK",
      "devices": [
        "DESKTOP",
        "MOBILE"
      ],
      "event": [
        "ONLINE"
      ],
      "map_value_types": [
        "EMAIL_HASH"
      ],
      "active": true,
      "start": "2019-07-25T17:09:41.32419522+02:00",
      "end": "2019-09-30T00:09:41.32419522+02:00",
      "max_event_age_in_second": 300,
      "max_notifying_per_id": 1000,
      "delay_before_notify_same_id_in_second": 3600,
      "webhook_endpoint": "https://my-endpoint.com/api/v1/endpoint",
      "capping_notify_per_minute": null,
      "status_endpoint": null,
      "filter_partner_audience": true,
      "ready_for_activation": true,
      "uploaded_ids": 0
    }
]
```

{% endtab %}

{% tab title="404 Could not find a cake matching this query." %}

```
```

{% endtab %}
{% endtabs %}

## Campaign

<mark style="color:blue;">`GET`</mark> `https://partner-api.sddan.com/api/v1/public/event-notify/campaign/:id`

#### Path Parameters

| Name | Type   | Description |
| ---- | ------ | ----------- |
| id   | string | campaign id |

#### Headers

| Name          | Type   | Description |
| ------------- | ------ | ----------- |
| Authorization | string | token       |

{% tabs %}
{% tab title="200 " %}

```
    {
      "id": "xxxxxxx-2feb-481a-9910-6d71dc337b00",
      "id_audience": "xxxxxx-6e58-4db7-8ada-53b7bace6da4",
      "id_partner": 12345,
      "name": "My first campaign",
      "notify_method": "WEBHOOK",
      "devices": [
        "DESKTOP",
        "MOBILE"
      ],
      "event": [
        "ONLINE"
      ],
      "map_value_types": [
        "EMAIL_HASH"
      ],
      "active": true,
      "start": "2019-07-25T17:09:41.32419522+02:00",
      "end": "2019-09-30T00:09:41.32419522+02:00",
      "max_event_age_in_second": 300,
      "max_notifying_per_id": 1000,
      "delay_before_notify_same_id_in_second": 3600,
      "webhook_endpoint": "https://my-endpoint.com/api/v1/endpoint",
      "capping_notify_per_minute": null,
      "status_endpoint": null,
      "filter_partner_audience": true,
      "ready_for_activation": true,
      "uploaded_ids": 0
    }
```

{% endtab %}

{% tab title="404 " %}

```
```

{% endtab %}
{% endtabs %}

## Create campaign

<mark style="color:green;">`POST`</mark> `https://partner-api.sddan.com/api/v1/public/event-notify/campaign`

JSON body

#### Headers

| Name          | Type   | Description |
| ------------- | ------ | ----------- |
| Authorization | string | token       |

#### Request Body

| Name                                        | Type    | Description                                                                       |
| ------------------------------------------- | ------- | --------------------------------------------------------------------------------- |
| filter\_partner\_audience                   | boolean | should used only traffic linked to partner id?                                    |
| ready\_for\_activation                      | boolean | is campaign should start?                                                         |
| status\_endpoint                            | string  | if precise, notify service will call this URL to check if notifying must continue |
| capping\_notify\_per\_minute                | number  | max number of notify sent by minute                                               |
| webhook\_endpoint                           | string  | url called by service to notify                                                   |
| delay\_before\_notify\_same\_id\_in\_second | number  |                                                                                   |
| max\_notifying\_per\_id                     | number  | max notification by hash (or reference id if used in upload)                      |
| max\_event\_age\_in\_second                 | number  | max event age in second before notification                                       |
| end                                         | string  | <p>end time, example : <br>2019-10-01T00:09:41.32419522+02:00</p>                 |
| start                                       | string  | <p>start time, example : <br>2019-07-25T17:09:41.32419522+02:00</p>               |
| map\_value\_types                           | string  | \["EMAIL\_HASH"]                                                                  |
| event                                       | array   | \["ONLINE"]                                                                       |
| devices                                     | array   | \["DESKTOP","MOBILE"]                                                             |
| notify\_method                              | string  | only value for now : WEBHOOK                                                      |
| name                                        | string  | campaign name                                                                     |
| id\_audience                                | string  | audience id                                                                       |

{% tabs %}
{% tab title="200 " %}

```
    {
      "id": "xxxxxxx-2feb-481a-9910-6d71dc337b00",
      "id_audience": "xxxxxx-6e58-4db7-8ada-53b7bace6da4",
      "id_partner": 12345,
      "name": "My first campaign",
      "notify_method": "WEBHOOK",
      "devices": [
        "DESKTOP",
        "MOBILE"
      ],
      "event": [
        "ONLINE"
      ],
      "map_value_types": [
        "EMAIL_HASH"
      ],
      "active": true,
      "start": "2019-07-25T17:09:41.32419522+02:00",
      "end": "2019-09-30T00:09:41.32419522+02:00",
      "max_event_age_in_second": 300,
      "max_notifying_per_id": 1000,
      "delay_before_notify_same_id_in_second": 3600,
      "webhook_endpoint": "https://my-endpoint.com/api/v1/endpoint",
      "capping_notify_per_minute": null,
      "status_endpoint": null,
      "filter_partner_audience": true,
      "ready_for_activation": true,
      "uploaded_ids": 0
    }
```

{% endtab %}

{% tab title="400 " %}

```
```

{% endtab %}
{% endtabs %}

## Update campaign

<mark style="color:orange;">`PUT`</mark> `https://partner-api.sddan.com/api/v1/public/event-notify/campaign/:id`

Use same parameters as create campaign

#### Path Parameters

| Name | Type   | Description |
| ---- | ------ | ----------- |
| id   | string | campaign id |

#### Headers

| Name          | Type   | Description |
| ------------- | ------ | ----------- |
| Authorization | string | token       |

{% tabs %}
{% tab title="200 " %}

```
    {
      "id": "xxxxxxx-2feb-481a-9910-6d71dc337b00",
      "id_audience": "xxxxxx-6e58-4db7-8ada-53b7bace6da4",
      "id_partner": 12345,
      "name": "My first campaign",
      "notify_method": "WEBHOOK",
      "devices": [
        "DESKTOP",
        "MOBILE"
      ],
      "event": [
        "ONLINE"
      ],
      "map_value_types": [
        "EMAIL_HASH"
      ],
      "active": true,
      "start": "2019-07-25T17:09:41.32419522+02:00",
      "end": "2019-09-30T00:09:41.32419522+02:00",
      "max_event_age_in_second": 300,
      "max_notifying_per_id": 1000,
      "delay_before_notify_same_id_in_second": 3600,
      "webhook_endpoint": "https://my-endpoint.com/api/v1/endpoint",
      "capping_notify_per_minute": null,
      "status_endpoint": null,
      "filter_partner_audience": true,
      "ready_for_activation": true,
      "uploaded_ids": 0
    }
```

{% endtab %}

{% tab title="302 " %}

```
```

{% endtab %}

{% tab title="404 " %}

```
```

{% endtab %}
{% endtabs %}
