Samsung DSP Reporting Service API examples

Prev Next

Initial setup & documentation

First, you need to generate your API Key: API Documentation

The full documentation is located here: Reporting Service API

Examples using cURL

cURL is an open source command line tool and library for transferring data with URL syntax.

Queries (Get Data)

In the example below, replace __API_KEY__ with your Samsung DSP API Key, __USERNAME__ with your username and __QUERY_HERE__ with the actual JSON query.

curl -X POST -H 'Authorization: Bearer __USERNAME__:__API_KEY__' -H 'Content-Type: application/json' --data '__JSON_HERE__' 'https://reporting.trader.adgear.com/v1/reports'

CURL example with a file

With cURL, you can also send a file with the data instead of having it all in the command. In the example below, replace __API_KEY__ with your Samsung DSP API Key, __USERNAME__ with your username and __FILE_HERE__ with the JSON file.

curl -X POST -H 'Authorization: Bearer __USERNAME__:__API_KEY__' -H 'Content-Type: application/json' -d@__FILE_HERE__ 'https://reporting.trader.adgear.com/v1/reports'

Simple report query

In the example below, replace __USER_ID__with your Samsung DSP User ID and __USERNAME__ with your username.

The query will get a delivery report of all campaigns of the account, with impressions and clicks for the day of 2016-04-01, in the time zone America/New_York. In this example, we also limit the result to 10, send a notification email to noreply@example.com and the output will be a csv, without compression.

Simple report JSON
{
  "title": "testReport",
  "author_id" : __USER_ID__,
  "author_name" : "__USERNAME__",
  "query":  {
    "type": "trader_delivery_all",
    "start_date": "2016-04-01T00:00:00Z",
    "end_date": "2016-04-01T23:59:59Z",
    "time_zone": "America/New_York",
    "dimensions": [
      "campaign_id"
    ],
    "metrics": [
      "impressions",
      "clicks"
    ],
    "limit": 10
  },
  "output_formats": [
    {"format": "csv", "compression": "none"}
  ],
  "notification": {
    "emails": [
      "noreply@example.com"
    ]
  }
}

Note that the examples above only show a subset of the available fields. Please check the documentation for more info on which fields are available (and how to include them in your JSON)