# Report Examples

Before you try out any code from here, fetch an API Key! Then replace <api-key> with the token you received.

# Create a Daily Report for a Campaign

Postman example: tonic-showcase/Reports/create daily report job for a campaign

This will create a daily report job called daily-single-campaign for the campaign with id <the-campaign-id>. This has to be replaced by a valid campaign id. It will be clustered by source id and filtered to only include information on desktop users using a Windows device or a Mac. The report will be sent to your.account@email-address.com.

curl -X POST \
  https://api.advertiser.tonic.com/v1/reportjobs \
  -H 'Content-Type: application/json' \
  -H 'Postman-Token: d9af8c1f-3489-4036-9d9c-73336bb32e75' \
  -H 'api-key: <api-key>' \
  -H 'cache-control: no-cache' \
  -d '{
    "name": "daily-single-campaign",
    "schedule": "daily",
    "parameters": {
    	"campaign_id": "<the-campaign-id>",
        "cluster_by": "source_id",
        "interval": "hours",
        "device_type": "desktop",
        "os": ["windows", "macintosh"]
    },
    "emails": ["your.account@email-address.com"]
}'

# Create One-Time Report for Single Campaign

Postman example: tonic-showcase/Reports/create one-time report for single campaign

This will create a one-time report with data from 2019-01-01 to 2019-02-01 for a campaign with id <the-campaign-id>. It will be clustered by browser and only include data for mobile devices running Android or iOS.

curl -X POST \
  https://api.advertiser.tonic.com/v1/reportjobs \
  -H 'Content-Type: application/json' \
  -H 'Postman-Token: f4de4926-6312-482d-aa53-342eb16584be' \
  -H 'api-key: <api-key>' \
  -H 'cache-control: no-cache' \
  -d '{
    "name": "one-time-single-campaign",
    "schedule": "once",
    "parameters": {
    	"campaign_id": "<the-campaign-id>",
        "cluster_by": "browser",
        "interval": "days",
        "device_type": "mobile",
        "os": ["android", "ios"]
    },
    "from": "2019-01-01 00:00:00",
    "to": "2019-02-01 23:59:59",
    "emails": ["your.account@email-address.com"]
}'
Last Updated: 10/19/2020, 10:11:43 AM