Introduction
We provide API for publishers for easier programmatic access to our resources.
Currently API supports running reports based on our "report builder" we use internally in consumable. New features will be added to the API in following period.
Endpoint url: https://publisher-api.consumable.com
. In following text consider all mentioned routes as relative to this url.
Authentication
Endpoint: /auth
API requires user to be authenticated in order to execute requests.
Use your login credentials from publisher dash for API authentication.
Authentication is simple - just send your username
and password
and you will get TOKEN in response which you can use in all following API requests.
Just set authorization header like: Authorization: Bearer [auth-token]
Token looks something like this:
eyJhbGciOiJIUzUxMiJ9eyJzdWIiOiJ0ZXN0QGNvbnN1bWFibGUuY29tIiwicm9sZXMiOlsiUFVCTElTSEVSIl0sInJpZ2h0cyI6W10sImlhdCI6MTU0ODE3ODk5MSwiZXhwIjoxNTUwNzcwOTkxfSDHg1IQEh8oFkVvHDUxfGRvEX1QJBpjUgZKFBV2HUIpbxxbWVBoR3EmaOqhnA==
Examples
Successful Authentication
Curl request
$ curl 'https://publisher-api.consumable.com/auth' -i -X POST \
-H 'Accept: application/json' \
-H 'Content-Type: application/json; charset=UTF-8' \
-d '{"password":"Consumable12345","email":"john@consumable.com"}'
HTTP request
POST /auth HTTP/1.1
Accept: application/json
Content-Type: application/json; charset=UTF-8
Host: publisher-api.consumable.com
Content-Length: 60
{"password":"Consumable12345","email":"john@consumable.com"}
Parameters
Path | Type | Description |
---|---|---|
|
|
The user’s email - must not be empty |
|
|
The user’s password - must not be empty |
Response
[auth-token]
[auth-token] - is the TOKEN you need for for all subsequent requests.
Bad Request
In case you forget to pass username and/or password, bad request 400
will be returned by the server
{"error":{"code":"2001","name":"Unclassified error","messages":["Please provide `email` and `password`"]}}
Invalid credentials
In case of invalid credentials, error code 401
is returned by the server
{"error":{"code":"2009","name":"Forbidden","messages":["Unauthorized Request"]}}
Ad units
Endpoint: /ad-units
Request
$ curl 'https://publisher-api.consumable.com/ad-units' -i -X GET \
-H 'Accept: application/json' \
-H 'Authorization: Bearer [auth-token]'
Response
[ {
"id" : "1",
"name" : "test-0001-cnsmbl-container-728x90-ads-dr-d",
"headerBidding" : false,
"readyApprovalRequired" : false,
"usingConfiant" : false,
"unitCreateRequestSent" : false,
"unitBuildPending" : false,
"unitCreateAdstxtOverride" : false,
"fromPublisherRequest" : false,
"bidder" : false,
"videoUnit" : false,
"videoUnitCompanion" : false,
"vastUnit" : false,
"feedType" : "N_A",
"test" : false,
"breakoutFromIframe" : false,
"createPixelUnit" : false,
"hasPendingUpdateEmails" : false,
"healthy" : false,
"serverbid" : false,
"s2s" : false,
"bidderCalc" : false,
"flag" : false,
"postHealthCheck" : false,
"waitsToBeActive" : false,
"enabled" : false
}, {
"id" : "1",
"name" : "test-0002-cnsmbl-container-300x250-ads-dr-d",
"headerBidding" : false,
"readyApprovalRequired" : false,
"usingConfiant" : false,
"unitCreateRequestSent" : false,
"unitBuildPending" : false,
"unitCreateAdstxtOverride" : false,
"fromPublisherRequest" : false,
"bidder" : false,
"videoUnit" : false,
"videoUnitCompanion" : false,
"vastUnit" : false,
"feedType" : "N_A",
"test" : false,
"breakoutFromIframe" : false,
"createPixelUnit" : false,
"hasPendingUpdateEmails" : false,
"healthy" : false,
"serverbid" : false,
"s2s" : false,
"bidderCalc" : false,
"flag" : false,
"postHealthCheck" : false,
"waitsToBeActive" : false,
"enabled" : false
} ]
Path | Type | Description |
---|---|---|
|
|
Ad unit ID - use it later on in reporting |
|
|
Ad unit name |
Reporting
Endpoint: /report
Reporting is based on our internal "report builder" which gives you ability to construct any report you want using 3 types of parameters:
-
Dimensions - the axis on which you are running your report - ex: run by day, ad unit, site etc..
-
Metrics - exact metrics you are interested in - ex: revenue, impressions, etc
-
Filters - filter result data by limiting date range, ad unit and/or site
Minimum requirements to run report: at least one dimensions, one metric and date range.
Dimensions
Name | Description |
---|---|
|
publisher itself - use this dimension when you want top level (total) metrics to be displayed |
|
sum data by day |
|
sum data by month |
|
run report by domain |
|
run report by ad unit |
|
possible values: |
|
widget size in format width x height |
|
ID of a widget |
Metrics
Name | Description |
---|---|
|
publisher name |
|
- |
|
- |
|
ad unit name |
|
custom ad unit name (if exist) |
|
domain url |
|
Net revenue |
|
number of widget impressions |
|
- |
|
- |
|
revenue share |
|
widget size in format width x height |
|
ID of a widget |
|
|
|
Unit status. Possible values: |
Filters
Name | Type | Description |
---|---|---|
|
string |
format: YYYY-MM-DD - ex: 2019-01-01 |
|
string |
format: YYYY-MM-DD - ex: 2019-01-01 |
|
array |
Array of ad unit ids - to get a list of ids check ad units route |
Lets run a couple of examples to see how different combinations are used in practice.
Examples
Publisher Revenue
Request
{
"version" : "1.0",
"forceDPDToday" : "0",
"debug" : "0",
"logPrefix" : "",
"metrics" : [ "PUBLISHER_REVENUE" ],
"dimensions" : [ "PUBLISHER" ],
"filters" : {
"dateFrom" : "2019-01-01",
"dateTo" : "2019-01-07",
"includeCnsmblData" : false
}
}
Response
{
"request" : {
"metrics" : [ "PUBLISHER_REVENUE" ],
"dimensions" : [ "PUBLISHER" ],
"filters" : {
"dateFrom" : "2019-01-01",
"dateTo" : "2019-01-07"
}
},
"report" : [ {
"publisherNetRevenue" : 1000
} ],
"total" : {
"publisherNetRevenue" : 1000
}
}
Path | Type | Description |
---|---|---|
|
|
Report request sent from publisher |
|
|
Generated report based on request. Report can have multiple rows (ex: multiple days), therefore array is used |
|
|
Total sum of values in |
|
|
Publisher revenue |
Publisher Revenue By Day
Request
{
"version" : "1.0",
"forceDPDToday" : "0",
"debug" : "0",
"logPrefix" : "",
"metrics" : [ "DAY", "PUBLISHER_REVENUE" ],
"dimensions" : [ "DAY" ],
"filters" : {
"dateFrom" : "2019-01-01",
"dateTo" : "2019-01-07",
"includeCnsmblData" : false
}
}
Response
{
"request" : {
"metrics" : [ "DAY", "PUBLISHER_REVENUE" ],
"dimensions" : [ "DAY" ],
"filters" : {
"dateFrom" : "2019-01-01",
"dateTo" : "2019-01-07"
}
},
"report" : [ {
"day" : "2019-01-01",
"publisherNetRevenue" : 100
}, {
"day" : "2019-01-02",
"publisherNetRevenue" : 200
}, {
"day" : "2019-01-03",
"publisherNetRevenue" : 300
} ],
"total" : {
"publisherNetRevenue" : 600
}
}
Path | Type | Description |
---|---|---|
|
|
Publisher revenue |
|
|
Day |
Ad Unit Revenue
Request
{
"version" : "1.0",
"forceDPDToday" : "0",
"debug" : "0",
"logPrefix" : "",
"metrics" : [ "AD_UNIT", "PUBLISHER_REVENUE", "BIDDER" ],
"dimensions" : [ "AD_UNIT" ],
"filters" : {
"dateFrom" : "2019-01-01",
"dateTo" : "2019-01-01",
"adUnitIds" : [ "e2b65b60-7927-499e-a4b0-cf1b17b94cb8" ],
"includeCnsmblData" : false
}
}
notice the adUnitIds
filter - if you omit it you will get report for all ad units
Response
{
"request" : {
"metrics" : [ "AD_UNIT", "PUBLISHER_REVENUE", "BIDDER" ],
"dimensions" : [ "AD_UNIT" ],
"filters" : {
"adUnitIds" : [ "e2b65b60-7927-499e-a4b0-cf1b17b94cb8" ],
"dateFrom" : "2019-01-01",
"dateTo" : "2019-01-01"
}
},
"report" : [ {
"bridgeAdUnitName" : "test-0001-cnsmbl-container-728x90-ads-dr-d",
"publisherNetRevenue" : 100,
"bidder" : true
} ],
"total" : {
"publisherNetRevenue" : 100
}
}
Path | Type | Description |
---|---|---|
|
|
Ad unit name |
|
|
Publisher ad unit revenue |
Site Revenue By Day
Request
{
"version" : "1.0",
"forceDPDToday" : "0",
"debug" : "0",
"logPrefix" : "",
"metrics" : [ "URL", "DAY", "PUBLISHER_REVENUE" ],
"dimensions" : [ "URL", "DAY" ],
"filters" : {
"dateFrom" : "2019-01-01",
"dateTo" : "2019-01-03",
"includeCnsmblData" : false
}
}
Response
{
"request" : {
"metrics" : [ "URL", "DAY", "PUBLISHER_REVENUE" ],
"dimensions" : [ "URL", "DAY" ],
"filters" : {
"dateFrom" : "2019-01-01",
"dateTo" : "2019-01-03"
}
},
"report" : [ {
"day" : "2019-01-01",
"url" : "test",
"publisherNetRevenue" : 100
}, {
"day" : "2019-01-02",
"url" : "test",
"publisherNetRevenue" : 200
}, {
"day" : "2019-01-03",
"url" : "test",
"publisherNetRevenue" : 300
} ],
"total" : {
"publisherNetRevenue" : 600
}
}
Path | Type | Description |
---|---|---|
|
|
Site url |
|
|
Day |
|
|
Publisher site revenue |