Deprecation Warning
DSP API v1 will continue to receive critical bug and security fixes, but no new functionality will be added going forward. Next version of DSP API is under development and when ready DSP API v1 will be deprecated.
Compound Entity Querying
If it's desired to limit the number of round trips to the server this can be achieved by attaching child entities using the fetch
query parameter
Querying using the "fetch" query parameter
A standard query for e.g. a client looks like the following:
GET /api/v1/media_agency/86b35325-794c-11e4-8425-daf437376f87/client/86b35326-794c-11e4-8425-daf437376f87?apikey=secret123
The response will look like this:
{
"id": "86b35326-794c-11e4-8425-daf437376f87",
"name": "Example Client",
"country": "SE"
}
By providing the fetch
parameter to the query, it's possible to expand the result to also include e.g. the campaigns and their activities;
GET /api/v1/media_agency/86b35325-794c-11e4-8425-daf437376f87/client/86b35326-794c-11e4-8425-daf437376f87?fetch=campaigns.activities&apikey=secret123
The response will look like this (note that campaigns and activities are now attached to the response):
{
"id": "86b35326-794c-11e4-8425-daf437376f87",
"name": "Example Client",
"country": "SE",
"campaigns": [
{
"id": "0",
"name": "default",
"activities": [
{
"id": "86b35327-794c-11e4-8425-daf437376f87",
"name": "Example Activity",
"flightStart": "2014-04-20T22:00:00.000+0000",
"flightStop": "2014-05-04T21:59:59.000+0000",
"enabled": false
},
{
"id": "86b35327-794c-11e4-8425-daf437376f88",
"name": "Example Activity",
"flightStart": "2014-08-31T22:00:00.000+0000",
"flightStop": "2014-11-02T22:59:59.000+0000",
"enabled": true
},
{
"id": "86b35327-794c-11e4-8425-daf437376f89",
"name": "Example Activity",
"flightStart": "2014-05-15T22:00:00.000+0000",
"flightStop": "2014-05-18T21:59:59.000+0000",
"enabled": false
}
]
}
]
}
Examples
To get the complete object graph for a client, the request would look like the following (NOTE! this is probably not a good idea since the graph quickly grows large and can take a long time to load):
GET /api/v1/media_agency/86b35325-794c-11e4-8425-daf437376f87/client/86b35326-794c-11e4-8425-daf437376f87?fetch=campaigns.activities.biddingPlans.creatives&apikey=secret123
To get the complete object graph for an activity, the request would look like the following:
GET /api/v1/media_agency/86b35325-794c-11e4-8425-daf437376f87/client/86b35326-794c-11e4-8425-daf437376f87/campaign/default/activity/86b35327-794c-11e4-8425-daf437376f87?fetch=biddingPlans.creatives&apikey=secret123
Last modified: Mon Sep 23 2024 11:48:54 GMT+0200 (Central European Summer Time)