Examples (Trader API v1)
  • 26 Jun 2023
  • 1 Minute to read
  • Dark
    Light

Examples (Trader API v1)

  • Dark
    Light

Article summary

Examples using cURL

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

Create a Report [/v1/reports/]

input.json:

{
  "title": "testReport",
  "author_id" : 1,
  "author_name" : "username",
  "query":  {
    "type": "adgear_publisher_delivery",
    "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": "tsv", "compression": "gzip"}
  ],
  "notification": {
    "emails": [
      "noreply@blah.com"
    ]
  }
}

submit command:

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

output:

{
  "id" : 6,
  "public_id" : "a97ffe7f-ed42-4d14-bdfa-86f9244ea914",
  "status" : "scheduled",
  "created_at" : "2016-04-26T19:36:04.499Z",
  "updated_at" : "2016-04-26T19:36:04.499Z",
  "author_id" : 1,
  "author_name" : "username",
  "title" : "testReport",
  "query" : {
    "type" : "adgear_publisher_delivery",
    "start_date" : "2016-04-01T00:00:00.000Z",
    "end_date" : "2016-04-01T23:59:59.000Z",
    "time_zone" : "America/New_York",
    "dimensions" : [ "campaign_id" ],
    "metrics" : [ "impressions", "clicks" ],
    "limit" : 10
  },
  "report_url" : "https://reporting.trader.adgear.com/reports/6",
  "report_public_url" : "https://reporting.trader.adgear.com/reports/public/a97ffe7f-ed42-4d14-bdfa-86f9244ea914",
  "output_formats" : [ {
    "compression" : "gzip",
    "output_format" : "tsv"
  } ]
}

Retrieve a Report [/v1/reports/{id}]

get command:

curl -X GET -H 'Authorization: Bearer testuser:ABCDE123' -H 'Content-Type: application/json' 'https://reporting.trader.adgear.com/v1/reports/6'

output:

{
  "id" : 6,
  "public_id" : "a97ffe7f-ed42-4d14-bdfa-86f9244ea914",
  "status" : "completed",
  "urls" : [ "http://reporting.trader.adgear.com/completed/27axad90-f474-4f39-b16b-4bdc2088f010/test_report_2016-04-01-00_2016-04-01-23_America_New_York.csv.gz" ],
  "secure_urls" : [ "https://reporting.trader.adgear.com/completed/27axad90-f474-4f39-b16b-4bdc2088f010/test_report_2016-04-01-00_2016-04-01-23_America_New_York.csv.gz" ],
  "created_at" : "2016-04-26T19:36:04.499Z",
  "updated_at" : "2016-04-26T19:36:08.548Z",
  "completed_at" : "2016-04-26T19:40:00.000Z",
  "author_id" : 1,
  "author_name" : "username",
  "title" : "testReport",
  "query" : {
    "type" : "adgear_publisher_delivery",
    "start_date" : "2016-04-01T00:00:00.000Z",
    "end_date" : "2016-04-01T23:59:59.000Z",
    "time_zone" : "America/Montreal",
    "dimensions" : [ "campaign_id" ],
    "metrics" : [ "impressions", "impressions_dropped" ],
    "order_fields" : [ ],
    "limit" : 10
  },
  "report_url" : "https://reporting.trader.adgear.com/reports/6",
  "report_public_url" : "https://reporting.trader.adgear.com/reports/public/27axad90-f474-4f39-b16b-4bdc2088f010",
  "output_formats" : [ {
    "compression" : "gzip",
    "output_format" : "tsv"
  } ]
}

Delete a Report [/v1/reports/{id}]

get command:

curl -X DELETE -H 'Authorization: Bearer testuser:ABCDE123' -H 'Content-Type: application/json' 'https://reporting.trader.adgear.com/v1/reports/6'

List reports [/v1/reports]

get command:

curl -X GET -H 'Authorization: Bearer testuser:ABCDE123' -H 'Content-Type: application/json' 'https://reporting.trader.adgear.com/v1/reports?limit=1&offset=5'

output:

[
  {
    "id" : 6,
    "public_id" : "a97ffe7f-ed42-4d14-bdfa-86f9244ea914",
    "status" : "completed",
    "urls" : [ "http://reporting.trader.adgear.com/completed/27axad90-f474-4f39-b16b-4bdc2088f010/test_report_2016-04-01-00_2016-04-01-23_America_New_York.csv.gz" ],
    "secure_urls" : [ "https://reporting.trader.adgear.com/completed/27axad90-f474-4f39-b16b-4bdc2088f010/test_report_2016-04-01-00_2016-04-01-23_America_New_York.csv.gz" ],
    "created_at" : "2016-04-26T19:36:04.499Z",
    "updated_at" : "2016-04-26T19:36:08.548Z",
    "completed_at" : "2016-04-26T19:40:00.000Z",
    "author_id" : 1,
    "author_name" : "username",
    "title" : "testReport",
    "query" : {
      "type" : "adgear_publisher_delivery",
      "start_date" : "2016-04-01T00:00:00.000Z",
      "end_date" : "2016-04-01T23:59:59.000Z",
      "time_zone" : "America/Montreal",
      "dimensions" : [ "campaign_id" ],
      "metrics" : [ "impressions", "impressions_dropped" ],
      "order_fields" : [ ],
      "limit" : 10
    },
    "report_url" : "https://reporting.trader.adgear.com/reports/6",
    "report_public_url" : "https://reporting.trader.adgear.com/reports/public/27axad90-f474-4f39-b16b-4bdc2088f010",
    "output_formats" : [ {
      "compression" : "gzip",
      "output_format" : "tsv"
    } ]
  }
]

Was this article helpful?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.