Follow these steps to switch to v4 of the reporting api from v3 of the CreativeX reporting api.
Change the endpoints you are using
In v4, we renamed our endpoints:
/reportsbecomes/reports/posts/reports/{id}/postsbecomes/reports/posts/{id}reports/dimensionsbecomes/reports/posts/dimensions
Make sure to update any places where you access our endpoints to reflect these name changes.
Switch to header-based authorization
In v4, we moved from parameter-based authentication to header-based authentication. You will no longer be able to authenticate by passing your access token in the access_token parameter. Instead, you will need to include it as a bearer token in the headers. Here's an example of what that might look like:
require 'httparty'
def access_token
'def456'
end
def base_url
'https://api.creativex.com/v4/reports'
end
def scores
path = '/posts'
headers = {
"Authorization" => "Bearer #{token}",
"Content-Type" => "application/json"
}
url = "#{base_url}#{path}"
response = HTTParty.get(url, headers: headers)
response.body
end
Pluralize optional filter parameter names
Make sure to pluralize each of the following parameters:
brand=>brandsmarket=>marketschannel=>channelsad_format=>ad_formatscontent_type=>content_types
You will not need to change the values you pass in for these parameters, just their names.
Check for omitted fields
When processing posts in a report, make sure you check for and handle any missing fields. Fields will be missing for a post when they are not applicable to it. For example, we will not include any inflight metrics for preflights, or video metrics for images.
This means that not every post in a report will contain the same fields. This is because different fields are applicable to different posts.
