/api/stats
Retrieve project launch stats and their associated session, message, question, render, and result counts.
Retrieve a list of stats
Retrieve a list of stats filtered via URL params.
URL Param | Type | Required | Notes |
---|---|---|---|
limit | int | No | Max number of results to return |
offset | int | No | Index of result list to start at |
format | string | No | Data format to return. Supported values are json and csv |
project_tag | string | No | Optional filter to restrict by tag passed in the project definition |
curl "https://platform.tillmobile.com/api/stats/?username=username&api_key=api_key"
<?php
// ## Example Dependencies
//
// - PHP >= 5.5.36
//
// - PHP cURL extension
// * sudo apt-get install php-curl
//
// - Composer
// * curl -sS https://getcomposer.org/installer | php
//
// ## Install Guzzle HTTP Client
// php composer.phar require guzzlehttp/guzzle
// Init Composer
require "vendor/autoload.php";
// Load Guzzle HTTP Client
use Guzzle\Http\Client;
// Your Till credentials
$till_username = "username";
$till_api_key = "api_key";
// Execute HTTP request
$client = new GuzzleHttp\Client();
try {
$res = $client->request(
"GET",
"https://platform.tillmobile.com/api/stats/?username=".$till_username."&api_key=".$till_api_key,
["body" => json_encode($till_project)]
);
// Till HTTP response body
echo $res->getBody();
} catch(Exception $e) {
echo $e;
}
?>
{
"meta": {
"limit": 20,
"previous": null,
"total_count": 1,
"next": "",
"offset": 0,
"plan": {
"name": "till_pro",
"price_usd": "19.99",
"renders": {
"max": 1000,
"used": 758
}
},
"totals": {
"active_sessions": 0,
"complete_sessions": 734,
"launches": 21,
"messages": 54,
"question_result_rate": 64.45,
"questions": 456,
"queued_sessions": 0,
"renders": 567,
"results": 345
}
},
"objects": [{
"num_active_sessions": 0,
"num_complete_sessions": 1,
"num_messages": 1,
"num_questions": 0,
"num_queued_sessions": 0,
"num_renders": 1,
"num_results": 0,
"project_definition": {
"text": "Hello Till from cURL!"
},
"project_launch_guid": "9d35ef60-149c-df34-b559-a67e323f3e0c",
"project_launch_start": "2017-08-11T11:27:44.756006",
"project_tag": "hello_test",
"sessions": [{
"created": "2017-08-11T11:27:44.756006",
"from": "+15558675309",
"to": "+15558675308",
"method": "SMS",
"status": "COMPLETE",
"sub_status": null
}]
}]
}
Retrieve a single stat
curl "https://platform.tillmobile.com/api/stats/{project_launch_guid}/?username=username&api_key=api_key"
<?php
// ## Example Dependencies
//
// - PHP >= 5.5.36
//
// - PHP cURL extension
// * sudo apt-get install php-curl
//
// - Composer
// * curl -sS https://getcomposer.org/installer | php
//
// ## Install Guzzle HTTP Client
// php composer.phar require guzzlehttp/guzzle
// Init Composer
require "vendor/autoload.php";
// Load Guzzle HTTP Client
use Guzzle\Http\Client;
// Your Till credentials
$till_username = "username";
$till_api_key = "api_key";
// The Till project_launch_guid returned by the /api/send/ request
$till_project_launch_guid = "project_launch_guid";
// Execute HTTP request
$client = new GuzzleHttp\Client();
try {
$res = $client->request(
"GET",
"https://platform.tillmobile.com/api/stats/".$till_project_launch_guid."/?username=".$till_username."&api_key=".$till_api_key,
["body" => json_encode($till_project)]
);
// Till HTTP response body
echo $res->getBody();
} catch(Exception $e) {
echo $e;
}
?>
{
"num_active_sessions": 0,
"num_complete_sessions": 25,
"num_messages": 4,
"num_questions": 46,
"num_queued_sessions": 0,
"num_renders": 50,
"num_results": 25,
"project_definition": {
"text": "Hello Till from cURL!"
},
"project_launch_guid": "9d35ef60-149c-df34-b559-a67e323f3e0c",
"project_launch_start": "2017-08-11T11:27:44.756006",
"project_tag": "hello_test",
"sessions": [{
"created": "2017-08-11T11:27:44.756006",
"from": "+15558675309",
"to": "+15558675308",
"method": "SMS",
"status": "COMPLETE",
"sub_status": null
}]
}
Updated over 7 years ago