Welect Gmbh

Data API

We provide a JSON API to enable programatically collecting the data that is also available in the customer.welect.de Dashboard Application. An account for the Dashboard is necessary to use this API.

General

Every request should contain the following Header:

Content-Type: application/json

Authentication

Authentication for all requests is done via a Bearer Token. A Token can be acquired by the following request:

POST https://api.customer.welect.de/api/v1/session

The request body should contain the email and password from your Dashboard account, for example:

{
    "email": "jane.doe@example.com"
    "password": "my-safe-password"
}

A response to this request will look like this:

{
  "user": {...user information...}
  "token": <your-token>
}

The token you receive should be used as a Bearer Token for all other requests, so the following Header has to be added to all following requests:

Authorization: Bearer <your-token>

Data Requests

Data is being provided for both publishers and advertisers.

Publisher - Placement Overview

This request will give you a list of all currently active placements registered by us.

GET https://api.customer.welect.de/api/v1/placements?archived=false

A response will look like this:

[
  {
    "publicId": "<unique-placement-id>",
    "name": "<placement-name>",
    "description": "...",
    "category": "...",
    "isArchived": false,
    "publisher": {
      ...
    }
  },
  ...
]

The publicId of each placement can be used to gather specific data for each placement.

Publisher - Placement Data

This request fetches all available data for the specified placements.

POST https://api.customer.welect.de/api/v1/events/placements

The following parameters have to be used in the json request body:

Parameter Description
from Specifies the date (YYYY-MM-DD) from which the data should be fetched
to Specifies the date (YYYY-MM-DD) until where the data should be fetched
ids A list of placement publicIDs acquired in the Placement Overview request
truncateTo Either "days" or "months", the data will be accumulated for each day/month in the range between the specified from and to date

An example request body looks like this:

{
    "from": "2023-05-12",
    "to": "2023-05-14",
    "ids": ["<unique-placement-id1>", "<unique-placement-id2>"],
    "truncateTo": "days"
}

An example response looks like this:

[
    {
        "events": [
            {
                "eventName": "placement_start",
                "timebuckets": [
                    {
                        "timestamp": "2023-05-12",
                        "weight": 1234
                    },
                    {
                        "timestamp": "2023-05-13",
                        "weight": 1234
                    },
                    {
                        "timestamp": "2023-05-14",
                        "weight": 1234
                    }
                ],
                "type": "integer"
            },
            ...all other placement events...
        ],
        "publicId": "<unique-placement-id1>",
        "publisherPublicId": "<unique-publisher-id>"
    },
    {
        "events": [
            {
                "eventName": "placement_start",
                "timebuckets": [
                    {
                        "timestamp": "2023-05-12",
                        "weight": 4321
                    },
                    ...
                ],
                "type": "integer"
            },
            ...
        ],
        "publicId": "<unique-placement-id2>",
        "publisherPublicId": "<unique-publisher-id>"
    }
]

Advertiser - Campaign Overview

This request will give you a list of all currently active campaigns registered by us.

GET https://api.customer.welect.de/api/v1/campaigns?archived=false

A response will look like this:

[
  {
    "publicId": "<unique-campaign-id>",
    "name": "<campaign-name>",
    "isArchived": false,
    "publisher": {
      ...
    }
  },
  ...
]

The publicId of each campaign can be used to gather specific data for each campaign.

Advertiser - Campaign Data

This request fetches all available data for the specified campaigns.

POST https://api.customer.welect.de/api/v1/events/campaigns

The following parameters have to be used in the json request body:

Parameter Description
from Specifies the date (YYYY-MM-DD) from which the data should be fetched
to Specifies the date (YYYY-MM-DD) until where the data should be fetched
ids A list of campaign publicIDs acquired in the Campaign Overview request
truncateTo Either "days" or "months", the data will be accumulated for each day/month in the range between the specified from and to date

An example request body looks like this:

{
    "from": "2023-05-12",
    "to": "2023-05-14",
    "ids": ["<unique-campaign-id1>", "<unique-campaign-id2>"],
    "truncateTo": "days"
}

An example response looks like this:

[
    {
        "events": [
            {
                "eventName": "consumption_started",
                "timebuckets": [
                    {
                        "timestamp": "2023-05-12",
                        "weight": 1234
                    },
                    {
                        "timestamp": "2023-05-13",
                        "weight": 1234
                    },
                    {
                        "timestamp": "2023-05-14",
                        "weight": 1234
                    }
                ],
                "type": "integer"
            },
            ...all other campaign events...
        ],
        "publicId": "<unique-campaign-id1>",
        "advertisementPublicIds": ["<unique-advertisement-id1>", "<unique-advertisement-id2>"],
        "advertiserPublicId": "<unique-advertiser-id>"
    },
    {
        "events": [
            {
                "eventName": "consumption_started",
                "timebuckets": [
                    {
                        "timestamp": "2023-05-12",
                        "weight": 4321
                    },
                    ...
                ],
                "type": "integer"
            },
            ...
        ],
        "publicId": "<unique-campaign-id2>",
        "advertisementPublicIds": ["<unique-advertisement-id1>", "<unique-advertisement-id2>"],
        "advertiserPublicId": "<unique-advertiser-id>"
    }
]

Advertiser - Advertisement Overview

This request will give you a list of all advertisements registered by us.

GET https://api.customer.welect.de/api/v1/advertisements

A response will look like this:

[
  {
    "publicId": "<unique-advertisement-id>",
    "name": "<advertisement-name>",
    "campaign": {
        ...
    }
  },
  ...
]

The publicId of each advertisement can be used to gather specific data for each advertisement.

Advertiser - Advertisement Data

This request fetches all available data for the specified advertisements.

POST https://api.customer.welect.de/api/v1/events/advertisements

The following parameters have to be used in the json request body:

Parameter Description
from Specifies the date (YYYY-MM-DD) from which the data should be fetched
to Specifies the date (YYYY-MM-DD) until where the data should be fetched
ids A list of advertisement publicIDs acquired either from Campaign Data or Advertisement Overview requests
truncateTo Either "days" or "months", the data will be accumulated for each day/month in the range between the specified from and to date

An example request body looks like this:

{
    "from": "2023-05-12",
    "to": "2023-05-14",
    "ids": ["<unique-advertisement-id1>", "<unique-advertisement-id2>"],
    "truncateTo": "days"
}

An example response looks like this:

[
    {
        "events": [
            {
                "eventName": "consumption_started",
                "timebuckets": [
                    {
                        "timestamp": "2023-05-12",
                        "weight": 1234
                    },
                    {
                        "timestamp": "2023-05-13",
                        "weight": 1234
                    },
                    {
                        "timestamp": "2023-05-14",
                        "weight": 1234
                    }
                ],
                "type": "integer"
            },
            ...all other advertisement events...
        ],
        "publicId": "<unique-advertisement-id1>",
        "campaignPublicId": "<unique-campaign-id>"
    },
    {
        "events": [
            {
                "eventName": "consumption_started",
                "timebuckets": [
                    {
                        "timestamp": "2023-05-12",
                        "weight": 4321
                    },
                    ...
                ],
                "type": "integer"
            },
            ...
        ],
        "publicId": "<unique-advertisement-id2>",
        "campaignPublicId": "<unique-campaign-id>"
    }
]