Examples & Templates

This page demonstrates sample queries for the /reports endpoint. You can modify and use these queries for your own purposes. Refer to the API Reference for information on syntax and variables. You can use the "Report IDs" exposed in this endpoint to query the /data endpoint for metrics.

Example Query

The below examples and templates are formatted as a JSON object, which is passed via the request's body.

Here is what a complete query to the Measurement API looks like. Again, notice the JSON contains all the parameters for your query.

curl -X POST "https://mapi.placed.com/report" \
-H "Authorization: Basic <your_base64_encoded_credentials>" \
-H "Content-Type: application/json" \
-d '{
  "page": 1,
  "filters": [
    {
      "predicates": [
        {
          "dimension": { "name": "partner" },
          "operator": { "name": "IN" },
          "values": [
            "ENTER AGENCY OR PARTNER NAME HERE"
          ]
        }
      ]
    }
  ]
}'

$url = "https://mapi.placed.com/report";
$ch = curl_init($url);
$cred = base64_encode("<your username>:<your password>");
$headers = array(
    "Authorization: Basic " . $cred,
    "Content-Type: application/json"
);
$payload = '{
  "page": 1,
  "filters": [
    {
      "predicates": [
        {
          "dimension": { "name": "partner" },
          "operator": { "name": "IN" },
          "values": [
            "ENTER AGENCY OR PARTNER NAME HERE"
          ]
        }
      ]
    }
  ]
}';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
$output = curl_exec($ch);
var_dump(json_decode($output));
curl_close($ch);



General

List All

To list all accessible campaigns, send an empty request body.

{}

📘

Default Pagination: 100 Rows

Note: By default, results are paginated after 100 rows.

Reports By Advertiser

{
  "page": 1,
  "filters": [
    {
      "predicates": [
        {
          "dimension": { "name": "advertiser" },
          "operator": { "name": "IN" },
          "values": [
            "ENTER ADVERTISER NAME HERE"
          ]
        }
      ]
    }
  ]
}

Reports by Agency/Partner

{
  "page": 1,
  "filters": [
    {
      "predicates": [
        {
          "dimension": { "name": "partner" },
          "operator": { "name": "IN" },
          "values": [
            "ENTER AGENCY OR PARTNER NAME HERE"
          ]
        }
      ]
    }
  ]
}

Reports by Date

{
  "page": 1,
  "filters": [
    {
      "predicates": [
        {
          "dimension": { "name": "startDate" },
          "operator": { "name": "BETWEEN" },
          "values": [
            "YYYY-MM-DD", 
            "YYYY-MM-DD"
          ]
        }
      ]
    }
  ]
}

Live Campaigns by Advertiser

{
  "page": 1,
  "filters": [
    {
      "predicates": [
        {
          "dimension": { "name": "status" },
          "operator": { "name": "IN" },
          "values": ["processing"]
        },
        {
          "dimension": { "name": "advertiser" },
          "operator": { "name": "IN" },
          "values": [
            "ENTER ADVERTISER NAME HERE"
          ]
        }
      ]
    }
  ]
}

Live Campaigns by Agency/Media Partner

{
  "page": 1,
  "filters": [
    {
      "predicates": [
        {
          "dimension": { "name": "status" },
          "operator": { "name": "IN" },
          "values": ["processing"]
        },
        {
          "dimension": { "name": "partner" },
          "operator": { "name": "IN" },
          "values": [
            "ENTER AGENCY OR PARTNER NAME HERE"
          ]
        }
      ]
    }
  ]
}

Only Overall/Summary Reports

This example returns only overall/summary reports for an advertiser (no custom or partner-level breakouts).

{
  "page": 1,
  "filters": [
    {
      "predicates": [
        {
          "dimension": { "name": "type" },
          "operator": { "name": "IN" },
          "values": ["overall"]
        },
        {
          "dimension": { "name": "advertiser" },
          "operator": { "name": "IN" },
          "values": [
            "ENTER ADVERTISER NAME HERE"
          ]
        }
      ]
    }
  ]
}

Only Partner-Level Reports

Return partner-level reports from a specific advertiser (no custom or overall reports).

{
  "page": 1,
  "filters": [
    {
      "predicates": [
        {
          "dimension": { "name": "type" },
          "operator": { "name": "IN" },
          "values": ["partner"]
        },
        {
          "dimension": { "name": "advertiser" },
          "operator": { "name": "IN" },
          "values": [
            "ENTER ADVERTISER NAME HERE"
          ]
        }
      ]
    }
  ]
}

Custom Reports

Return only "custom" reports for an advertiser (no overall or partner-level reports).

{
  "page": 1,
  "filters": [
    {
      "predicates": [
        {
          "dimension": { "name": "type" },
          "operator": { "name": "IN" },
          "values": ["custom"]
        },
        {
          "dimension": { "name": "advertiser" },
          "operator": { "name": "IN" },
          "values": [
            "ENTER ADVERTISER NAME HERE"
          ]
        }
      ]
    }
  ]
}

Reports by Report Name

Return list of reports which have a name similar to the request.

{
  "page": 1,
  "filters": [
    {
      "predicates": [
        {
          "dimension": { "name": "name" },
          "operator": { "name": "LIKE" },
          "values": ["omnichannel"]
        }
      ]
    }
  ]
}