GET /api/v3/analytics/constants/periods¶
Summary¶
GET /analytics/constants/periods
Description¶
Return a list of valid period constants for querying the analytics endpoints. These constants are used for grouping the data by a specific period of time
Tags: analytics
Parameters¶
Header Parameters¶
| Name | Type | Required | Description | Example |
|---|---|---|---|---|
Authorization |
string |
✓ Yes | Bearer {AuthToken} |
|
Content-Type |
string |
✓ Yes | application/json |
|
Accept |
string |
✓ Yes | application/json |
|
AppIdV3 |
string |
✓ Yes | LCUID-LAP-********-****-****-****-************ |
Responses¶
Response: 200¶
Content Type: application/json¶
Schema¶
Type: object
Properties:
success(boolean)periods(array)-
Array items:
objectType:objectProperties:
period(string)name(string)seconds(integer)has_time(boolean)selectable(boolean)
Example Response¶
{
"success": true,
"periods": [
{
"period": "per-second",
"name": "Per Second",
"seconds": 1,
"has_time": true,
"selectable": false
},
{
"period": "per-minute",
"name": "Per Minute",
"seconds": 60,
"has_time": true,
"selectable": false
},
{
"period": "hourly",
"name": "Hourly",
"seconds": 3600,
"has_time": true,
"selectable": false
},
{
"period": "daily",
"name": "Daily",
"seconds": 86400,
"has_time": false,
"selectable": true
},
{
"period": "weekly",
"name": "Weekly",
"seconds": 604800,
"has_time": false,
"selectable": true
},
{
"period": "monthly",
"name": "Monthly",
"seconds": 2678400,
"has_time": false,
"selectable": true
}
]
}
Example Implementations¶
Bash (cURL)¶
curl --request GET \
--get "https://api.lucit.app/api/v3/analytics/constants/periods" \
--header "Authorization: Bearer {AuthToken}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "AppIdV3: LCUID-LAP-********-****-****-****-************"
JavaScript (Fetch API)¶
const url = new URL(
"https://api.lucit.app/api/v3/analytics/constants/periods"
);
const headers = {
"Authorization": "Bearer {AuthToken}",
"Content-Type": "application/json",
"Accept": "application/json",
"AppIdV3": "LCUID-LAP-********-****-****-****-************",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
PHP (Guzzle)¶
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://api.lucit.app/api/v3/analytics/constants/periods',
[
'headers' => [
'Authorization' => 'Bearer {AuthToken}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'AppIdV3' => 'LCUID-LAP-********-****-****-****-************',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Python (Requests)¶
import requests
import json
url = 'https://api.lucit.app/api/v3/analytics/constants/periods'
headers = {
'Authorization': 'Bearer {AuthToken}',
'Content-Type': 'application/json',
'Accept': 'application/json',
'AppIdV3': 'LCUID-LAP-********-****-****-****-************'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example Responses¶
200 Response¶
{
"success": true,
"periods": [
{
"period": "per-second",
"name": "Per Second",
"seconds": 1,
"has_time": true,
"selectable": false
},
{
"period": "per-minute",
"name": "Per Minute",
"seconds": 60,
"has_time": true,
"selectable": false
},
{
"period": "hourly",
"name": "Hourly",
"seconds": 3600,
"has_time": true,
"selectable": false
},
{
"period": "daily",
"name": "Daily",
"seconds": 86400,
"has_time": false,
"selectable": true
},
{
"period": "weekly",
"name": "Weekly",
"seconds": 604800,
"has_time": false,
"selectable": true
},
{
"period": "monthly",
"name": "Monthly",
"seconds": 2678400,
"has_time": false,
"selectable": true
}
]
}