Skip to main content

Schedule a report

Create your first report schedule using IQM's API in this step-by-step quickstart guide.

Get started scheduling a report with the following endpoints:

POST
POST
POST

About IQM reports​

The IQM APIs provide access to all dimensions and KPIs of ad-serving reporting data in JSON format.

Reports can be either daily or aggregated. The daily report includes the date as a dimension and provides the data breakdown by date. Reports provide five top-level dimensions of filtering support, and can be filtered for multiple values in each dimension.

A report can cover up to 365 days of data for any dimension combination. Run multiple reports if you need more than that.

More resources​

Schedule a report​

This quickstart guide covers how to schedule a report.

The minimum requirements to perform this task are: logging in with authentication credentials, and having a campaign started in order to execute reports. Once these steps are accomplished, more can be learned about IQM's API through the guidelines pages.

  1. Log in
    • Optional if you have already logged in and have a token
  2. Save a report
    • Skip this step if you already have a saved report and its ID
  3. Schedule a report
    • Execute scheduling event with frequency, day, and end date parameters

Authentication​

Use the following header parameters for all requests after logging in:

Headers
Authorization
string required
Bearer followed by the access_token from the login response.
See Sign up and authenticate.
X-IAA-OW-ID
integer required
Organization Workspace ID header.

Step 1: Log in​

POST

To log in, send the Authorization: Basic header with your Base64-encoded Client ID and Client Secret, and send the request body as form data (application/x-www-form-urlencoded). The response contains an OAuth access token.

To find the Organization Workspace IDs that you have access to, use Get list of accessible Organizations.

Headers
Authorization
string required
Basic followed by your Base64-encoded client_id:client_secret.
See Sign up and authenticate.
Content-Type
string required
application/x-www-form-urlencoded. Send the request body as form data.
Request schema
grant_type
string required
password for login.
See OAuth Grant Types.
username
string required
User account email.
password
string required
User account password.
Request sample
curl -i --location 'https://api.iqm.com/api/v3/ua/oauth/token' \
--header 'accept: application/json, text/plain, */*' \
--header 'Authorization: Basic <base64 of client_id:client_secret>' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=password' \
--data-urlencode 'username=user@iqm.com' \
--data-urlencode 'password=<your password>'
Response 200
{
"access_token": "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIn0...",
"refresh_token": "eyJhbGciOiJIUzUxMiIsInR5cCIgOiAiSldUIn0...",
"scope": "read write",
"token_type": "bearer",
"expires_in": 86399
}
More responses
Response 401
{
"success": false,
"errorObjects": [
{
"error": "Bad Credentials or invalid grant type"
}
]
}
Response 403
{
"error": "Client details are not provided."
}

Step 2: Save a report​

POST

A schedule is attached to a saved report, so save the report first. The response's data is the new report's ID; use it as reportId in the next step.

For further information see Create report.

Request schema
reportName
string required
Name of the report.
startDate
integer required
Unix epoch timestamp of start date, in milliseconds.
endDate
integer required
Unix epoch timestamp of end date, in milliseconds. The range can be at most 365 days.
dimensions
string required
JSON-encoded array of dimensions, for example [{"filter":"campaign"}]. Add a value array to a dimension to filter by its IDs.
columns
array of strings required
Metrics to include, such as impressions and clicks. Dimensions go in dimensions, not here.
requestType
integer required
1: daily, 2: aggregated, 3: weekly, 4: monthly.
reportAggregated
string required
"0" or "1". See Execute a report.
timezoneId
integer required
Timezone ID.
timezoneName
string required
Timezone name, for example US/Eastern.
Request sample
{
"reportName": "Weekly campaign delivery",
"startDate": 1777262400000,
"endDate": 1779854400000,
"dimensions": "[{\"filter\":\"campaign\"}]",
"columns": [
"impressions",
"clicks",
"CTR",
"spent"
],
"requestType": 1,
"reportAggregated": "0",
"timezoneId": 29,
"timezoneName": "US/Eastern"
}
Response 200
{
"success": true,
"data": 9828
}
More responses
Response 422
{
"success": false,
"errorObjects": [
{
"error": "Please pass report name for report creation",
"field": "reportName"
}
]
}

Step 3: Schedule a report​

POST

Use the reportId from Step 2 and decide the delivery frequency, day, and end date of scheduled reports. This API saves the delivery information and returns a success message.

For further information see Scheduling management.

Request schema
reportId
integer required
ID of the saved report from Step 2. The schedule is created on this report.
subscriberEmails
array of strings required
List of emails to which the report is sent.
fileType
integer required
Report file type ID. The report is sent in the selected file format.
Supported values
1CSV
2XLSX
deliveryFrequency
integer required
Delivery frequency type ID for the emails to be sent.
Supported values
1One time now
2Daily until
3Weekly until
4Monthly until

1 (one time now) emails the report right away and removes any schedule already saved on the report.
deliveryDay
string
[Required if deliveryFrequency is weekly or monthly] Day when the report is sent (not case-sensitive).
Weekly: Sunday, Monday, ...
Monthly: First, Last, or a day of the month 1 to 28.
eventEndDate
integer
[Required if deliveryFrequency is daily, weekly, or monthly] Unix epoch timestamp in milliseconds; must be in the future. This is event's end date, the scheduled report is stopped after the eventEndDate is exceeded.
runningTotalEnabled
boolean optional
Flag to indicate if the 'Total' Running is enabled for the report. This flag is supported only with 'Campaign' dimension. If this is true the start-date for the report duration should be the EARLIEST campaign start date, so the report-time-period will be from the earliest-campaign-start-date to the report-end-date.
earliestCampaignStartDate
integer
[Required with runningTotalEnabled as true] Unix epoch timestamp, in milliseconds. This is campaign's EARLIEST start date from the selected campaigns, which is set as the start date of the report-time-period.
Request sample
{
"reportId": 1235,
"subscriberEmails": [
"sample_email1@example.com",
"sample_email2@example.com"
],
"fileType": 2,
"deliveryFrequency": 3,
"eventEndDate": 1814399999000,
"deliveryDay": "MONDAY",
"runningTotalEnabled": true,
"earliestCampaignStartDate": 1670674108900
}
Response 200
{
"success": true,
"data": {
"scheduledData": {
"deliveryDay": "MONDAY",
"deliveryFrequency": 3,
"earliestCampaignStartDate": 1670674108900,
"eventEndDate": 1814399999000,
"fileType": 2,
"reportId": 1235,
"runningTotalEnabled": true,
"subscriberEmails": [
"sample_email1@example.com",
"sample_email2@example.com"
]
},
"message": "Report schedule has been successfully updated."
}
}
Have a question?
Was this page helpful?