Get Impressions Usage
1 min
GET
https://api.optimizely.com/v2/billing/usage/{account_id}
Path Parameters
- account_idinteger<int64>requiredDescriptionFormatint64
Query Parameters
- per_pageintegerDescriptionDefault25Maximum100
- pageintegerDescriptionDefault1
- usage_date_fromstringrequiredDescriptionPattern^\d{4}-\d{2}-\d{2}$
- usage_date_tostringrequiredDescriptionPattern^\d{4}-\d{2}-\d{2}$
- platformsstring[]DescriptionDefaultedge,fullstack,web
- querystringDescriptionDefault
- sortstringDescriptionDefaultimpression_count
- orderstringDescriptionDefaultdesc
Responses
200
- ImpressionsUsage[]
- experiment_idinteger<int64>requiredExampleDescriptionFormatint64
- experiment_namestringrequiredExampleDescription
- experiment_statusstringrequiredExampleDescription
- impression_countinteger<int64>requiredExampleDescriptionFormatint64
- platformstringrequiredExampleDescriptionDefaultweb
- project_idinteger<int64>requiredExampleDescriptionFormatint64
- project_namestringrequiredExampleDescription
400
- Error
- codestring
- messagestring
- messagesobject
- uuidstring<uuid>Formatuuid
401
- Error
- codestring
- messagestring
- messagesobject
- uuidstring<uuid>Formatuuid
403
- Error
- codestring
- messagestring
- messagesobject
- uuidstring<uuid>Formatuuid
404
- Error
- codestring
- messagestring
- messagesobject
- uuidstring<uuid>Formatuuid
default
- Error
- codestring
- messagestring
- messagesobject
- uuidstring<uuid>Formatuuid
curl
curl --request GET \
--url 'https://api.optimizely.com/v2/billing/usage/{account_id}?per_page=25&page=1&usage_date_from=string&usage_date_to=string&platforms=edge%2Cfullstack%2Cweb&query=string&sort=impression_count&order=desc' \
--header 'accept: application/json'javascript
var myHeaders = new Headers();
myHeaders.append("accept", "application/json");
myHeaders.append("content-type", "application/json");
var requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.optimizely.com/v2/billing/usage/{account_id}?per_page=25&page=1&usage_date_from=string&usage_date_to=string&platforms=edge,fullstack,web&query=string&sort=impression_count&order=desc", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));ruby
require "uri"
require "json"
require "net/http"
url = URI("https://api.optimizely.com/v2/billing/usage/{account_id}?per_page=25&page=1&usage_date_from=string&usage_date_to=string&platforms=edge,fullstack,web&query=string&sort=impression_count&order=desc")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["accept"] = "application/json"
request["content-type"] = "application/json"
response = https.request(request)
puts response.read_body
python
import requests
import json
url = "https://api.optimizely.com/v2/billing/usage/{account_id}?per_page=25&page=1&usage_date_from=string&usage_date_to=string&platforms=edge,fullstack,web&query=string&sort=impression_count&order=desc"
payload = {}
headers = {
'accept': 'application/json',
'content-type': 'application/json'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
200
// Return Impression Usage info for account
[
{
"experiment_id": 3239,
"experiment_name": "Renewable energy",
"experiment_status": "Running, Not started",
"impression_count": 322010712450,
"platform": "web, fullstack, edge",
"project_id": 3094,
"project_name": "Landing Page Optimization"
}
]400
// Invalid ID
{
"code": "",
"message": "",
"messages": {},
"uuid": ""
}401
// Invalid credentials
{
"code": "",
"message": "",
"messages": {},
"uuid": ""
}403
// You do not have permission to account
{
"code": "",
"message": "",
"messages": {},
"uuid": ""
}404
// Impression Usage not found
{
"code": "",
"message": "",
"messages": {},
"uuid": ""
}default
// Unexpected error
{
"code": "",
"message": "",
"messages": {},
"uuid": ""
}