average complete
Deprecated: This API (insights/2.5) is deprecated and no longer supported. Only version 3.0 (insights/3.0) is supported. Use the Metrics V3 API Guide instead.
Gets the average for completed plays.
Key:
average_complete
Resource URI:
/metrics.json
Method:
GET
Query Parameters
Example Query String:
?metrics=average_complete&filter_ids={{filter_ids}}&day={{day}}
Required:
metrics=average_complete- Gets the average completed plays.-
Specify one of the following time periods for historical data. No time parameter specifies live data.
day={{yyyy-mm-dd}}month={{yyyy-mm}}start_day={{yyyy-mm-dd}}&{{end_day=yyyy-mm-dd}}start_time={{yyyy-mm-dd:hh}}&{{end_time=yyyy-mm-dd:hh}}
If you specify the current month, the period extends from the first day of the month to today or yesterday.
For an hourly range, specify both the start and end times including the hour of the beginning and ending day for which to return data.
Each API call returns up to 30 days of data.
Data is available for up to 13 months.
Note: The Experience Insights APIs return data in the time zone for the c3 account.
filter_ids={{filter_ids}}- The call must specify one or more comma-separated filter IDs. To get filter IDs, call the/filtersendpoint.
Optional:
None.
Example Request
- Curl
- Python
- JavaScript
- PHP
- Java
curl
'https://api.conviva.com/insights/2.5/metrics.json?metrics=average_complete&filter_ids={{filter_ids}}&day={{day}}' \
-H 'Cache-Control: no-cache' \
-u 'client_ID:secret' \
import base64
import http.client
conn = http.client.HTTPSConnection("api.conviva.com")
encoded = b64encode(b"client_ID:secret").decode("ascii")
headers = {
'Cache-Control': 'no-cache',
'Authorization': 'Basic %s' % encoded
}
api = "/insights/2.5/metrics.json"
query = "?metrics=average_complete&filter_ids={{filter_ids}}&day={{day}}"
path = api + query
conn.request("GET", path, headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var data = null;
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("GET", "https://api.conviva.com/insights/2.5/metrics.json?metrics=average_complete&filter_ids={{filter_ids}}&day={{day}}");
xhr.setRequestHeader("Cache-Control", "no-cache");
xhr.setRequestHeader("Authorization", "Basic " + btoa("client_ID:secret"));
xhr.send(data);
<?php
$request = new HttpRequest();
$request->setUrl('https://api.conviva.com/insights/2.5/metrics.json');
$request->setMethod(HTTP_METH_GET);
$request->setQueryData(array(
'metrics' => 'average_complete',
'filter_ids' => '{{filter_ids}}',
'day' => '{{day}}'
));
$request->setHeaders(array(
'Cache-Control' => 'no-cache'
'Authorization' => 'Basic'.base64_encode("$client_ID:$secret")
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
OkHttpClient client = new OkHttpClient.Builder().authenticator(new Authenticator() {
public Request authenticate(Route route, Response response) throws IOException {
String credential = Credentials.basic(client_ID, secret);
return response.request().newBuilder().header("Authorization", credential).build();
}
}).build();
Request request = new Request.Builder()
.url("https://api.conviva.com/insights/2.5/metrics.json?metrics=average_complete&filter_ids={{filter_ids}}&day={{day}}")
.get()
.addHeader("Cache-Control", "no-cache")
.build();
Response response = client.newCall(request).execute();
Success Response
Response Code:
200
Response Type:
application/jscon
Response Description:
Historical
Simple Series
Returns JSON with the average complete value.
Example JSON Response
{
"average_complete": {
"meta": {
"status": 0
},
"type": "simple_series",
"filters": {
"250": [
9.47
]
}
}
} Common Error Responses
Code: 400 Bad request
Content: { reason : "At least one filter_id should be provided." }
Content: { reason : "Time range is not valid for metric <metric>. Invalid day format"}
Content: { reason : "The credentials you used are not valid. Please check your credentials and try again." }
Code: 401 UNAUTHORIZED
Content: { error : "Log in" }
Code: 422 UNPROCESSABLE ENTRY
Content: { error : "Email Invalid" }
Code: 429 Too Many Requests
Content: { error : "Too Many Requests" }
More Information
See Metrics.
Type to search. Results appear as you type.