Skip to content

Report

Generate data reports collected by the Green Ad Tag.

The /report endpoint operates asynchronously. Users request a report by submitting specifications to this endpoint and immediately receive a report ID. The report computation begins in the background after this request.

The actual computation time depends on the report's size and scale.

Users can access the report via the /report/{id} endpoint. If the report is ready, this endpoint will return the report's result.

Create new Report

Request a report on stored data (i.e. data from Green Ad Tag pixels, or from API calls using store=true). This will return a report id, which can be used to check the status of the report, and to retrieve the result.

Endpoint

https://api.good-loop.com/v0/report/new

Method

POST

Parameters

Parameter Description Type Required
start Start date for the report string Yes
end End date for the report string Yes
q Query string for filtering reports. E.g. use adid:X where X is the id of a Green Tag you generated string No
breakdown (optional) Specify a breakdown for the report by format, domain, country, time or os string No
callback If provided, this will be called with the completed report when ready string No

Start and end date

You can specify the start and end date for the report in one of two ways:

  1. Use the start and end parameters to specify the start and end date in ISO-8601 format of yyyy-mm-dd (date only) or yyyy-mm-ddTHH:mmZ (date and time).
  2. Time period strings. For example: 3 months ago or 2 days ago.

Example

curl --header 'Authorization: token <your-api-key>' \
--request POST \
'https://api.good-loop.com/v0/report/new?start=2%20months%20ago&end=1%20day%20ago'
curl --header 'Authorization: token <your-api-key>' \
--request POST \
'https://api.good-loop.com/v0/report/new?start=2023-11-30T00:00:00Z&end=2023-12-01T00:00:q=adid:fo123&breakdown=format'

Response

{
  "id":"apireport_xxxxxxxx"
}

Get Report

Get the status of a report, or retrieve the report's result.

Endpoint

https://api.good-loop.com/v0/report/{id}

Method

GET

Example

curl --header 'Authorization: token <your-api-key>' \
--location 'https://api.good-loop.com/v0/report/apireport_xxxxxxxx'

Result

[
  ["vertiser","campaign","count","co2","co2base","co2creative","co2supplypath"],
  ["myAdverister","myCampaign",908358.0,428.0068155505176,135.74320822521372,85.03729767501088,207.22630965029302]
]