ADBRO provides Publishers with an extensive GraphQL Reporting API alongside the required development tools like GraphiQL Console and Documentation Explorer.
Learn more about GraphQL and Language Support at: graphql.org.
Building Reports with GraphiQL
The easiest way to get started with GraphQL API is to use GraphiQL Console with Documentation Explorer. Using GraphiQL requires you to have an access to ADBRO Publisher Portal. Feel free to contact your Account Manager for credentials.
After authenticating with ADBRO Publisher Portal, you will be able to access all your properties through the publicly available GraphiQL Console: https://portal.adbro.me/api/graphql/.
Object Identifiers
All objects in ADBRO have GUID (UUID4) identifiers. These identifiers can be collected from ADBRO Publisher Portal URI Schema, your Account Manager or directly from the GraphQL API:
{
publisher(guid: "db5d938a-9198-44c2-8991-1ff90caee09e") {
name
sites {
guid
name
address
isActive
slots {
guid
name
}
}
}
}
This Query will result full list of Sites and Slots within the Publisher with GUID "db5d938a-9198-44c2-8991-1ff90caee09e". It's also possible to request Sites and Slots directly within a single Query (thanks to GraphQL):
{
site(guid: "7de6071f-f56a-47a7-b33b-83cb88638b11") {
name
address
}
slot(guid: "964b3b54-8432-4f17-80e9-911176b6552e") {
name
}
}
Reports Examples
Getting summary metrics for January 2021 across all the Active Sites in Vientam managed by you:
{
office(slug: "vietnam") {
sites {
guid
name
metrics(start: "2021-01-01T00:00:00", end: "2021-01-31T23:59:59", tz: "Asia/Saigon") {
hits
impressions
viewableImpressions
clicks
revenue(currency: VND)
}
}
}
}
Getting daily metrics for January 2021 for the specific Site:
{
site(guid: "72d2099b-c183-41a9-8221-955a1a4ddc66") {
name
metrics(start: "2021-01-01T00:00:00", end: "2021-01-31T23:59:59", tz: "Asia/Saigon") {
hits
impressions
revenue(currency: VND)
date
}
}
}
Getting hourly metrics for 1 January 2021 grouped by Template for the specific Slot:
{
slot(guid: "bb0a7cb0-6b79-483b-abc2-e3d3ee4dbe30") {
name
templates {
name
metrics(start: "2021-01-01T00:00:00", end: "2021-01-01T23:59:59", tz: "Asia/Saigon") {
impressions
revenue(currency: VND)
datetime
}
}
}
}
Full list of available Fields and Metrics is available through the Documentation Explorer right from GraphiQL Console. Feel free to contact your Account Manager for an assistance with building Reports.
Authenticating your Application
In order to Authenticate your Application you will need to collect an authentication token using tokenAuth mutation and pass this token as a HTTP Header with every query. You can test your authentication flow using GraphiQL in Incognito Mode:
- Execute tokenAuth mutation:
mutation {
tokenAuth(username: "EMAIL", password: "PASSWORD") {
token
}
} - Collect the value of token from Response
- Add token as an "Authorization" Request Header:
{
"Authorization": "jwt TOKEN"
}
Check out the complete example on the following screenshot:
Limitations
GraphQL Reporting API has the following limitations in order to provide high performance integration experience:
- Single Query can only contain up to 10 metrics fields;
- Single metrics field can request up to 3 months of data.
Comments
0 comments
Please sign in to leave a comment.