Skip to main content

How to get a month of data out of Mediahawk

In this guide we will show you how to get call and Call-to-Action (CTA) data for a date period. There are other ways you can get this data out, to see the entire list of options please check the calls or CTAs sections under reference.

Before you begin this guide, please ensure you have followed the Authenticate guide and have a valid token.

You can download a full working code example for this guide here:

CURL, PHP, Node.js, Python, C#

How to get a month's worth of calls

In a scenario where you would need last month's call data, you can achieve this by using the API.

This is an example of getting call records for a month, including a demonstration of how to paginate the response for smaller data sets as per your system's needs.

info

limit and offset parameters are available to control the amount of call data returned. The limit parameter has a maximum of 3000 records.

apiKey="<YOUR_API_KEY>"
limit="100"
offset="0"
fromDate="2022-10-01"
toDate="2022-10-31"

calls="$(curl -L -X GET "https://www.reports.mediahawk.co.uk/rest/v2_0/calls?api_key=${apiKey}&from_date=${fromDate}&to_date=${toDate}&limit=${limit}&offset=${offset}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
)"
echo $calls

How to get a month's worth of CTAs

In the same fashion as getting a month of call data, you can also do the same for CTAs.

info

limit and offset parameters are available to control the amount of CTA data returned. The limit parameter has a maximum of 3000 records.

apiKey="<YOUR_API_KEY>"
limit="100"
offset="0"
fromDate="2022-10-01"
toDate="2022-10-31"

ctas="$(curl -L -X GET "https://www.reports.mediahawk.co.uk/rest/v2_0/ctas?api_key=${apiKey}&from_date=${fromDate}&to_date=${toDate}&limit=${limit}&offset=${offset}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
)"
echo $ctas