Generate a read-only report
curl --request POST \
--url https://fleet.graviton.ma/api/v2/reports/generate \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "latest_positions",
"from": "2023-11-07T05:31:56Z",
"to": "2023-11-07T05:31:56Z"
}
'import requests
url = "https://fleet.graviton.ma/api/v2/reports/generate"
payload = {
"type": "latest_positions",
"from": "2023-11-07T05:31:56Z",
"to": "2023-11-07T05:31:56Z"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
type: 'latest_positions',
from: '2023-11-07T05:31:56Z',
to: '2023-11-07T05:31:56Z'
})
};
fetch('https://fleet.graviton.ma/api/v2/reports/generate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://fleet.graviton.ma/api/v2/reports/generate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'type' => 'latest_positions',
'from' => '2023-11-07T05:31:56Z',
'to' => '2023-11-07T05:31:56Z'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"success": true,
"data": {
"type": "<string>",
"generated_at": "2023-11-07T05:31:56Z",
"rows": [
{}
],
"count": 123
},
"meta": {
"request_id": "<string>",
"page": 123,
"per_page": 123,
"total": 123,
"pages": 123
}
}{
"success": false,
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
},
"meta": {
"request_id": "<string>",
"page": 123,
"per_page": 123,
"total": 123,
"pages": 123
}
}{
"success": false,
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
},
"meta": {
"request_id": "<string>",
"page": 123,
"per_page": 123,
"total": 123,
"pages": 123
}
}{
"success": false,
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
},
"meta": {
"request_id": "<string>",
"page": 123,
"per_page": 123,
"total": 123,
"pages": 123
}
}Reports
Generate a read-only report
Generates a read-only report with at most 10,000 rows. Events and RFID reports require from and to, with an interval of at most 93 days. Requires the reports permission for subaccounts.
POST
/
reports
/
generate
Generate a read-only report
curl --request POST \
--url https://fleet.graviton.ma/api/v2/reports/generate \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "latest_positions",
"from": "2023-11-07T05:31:56Z",
"to": "2023-11-07T05:31:56Z"
}
'import requests
url = "https://fleet.graviton.ma/api/v2/reports/generate"
payload = {
"type": "latest_positions",
"from": "2023-11-07T05:31:56Z",
"to": "2023-11-07T05:31:56Z"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
type: 'latest_positions',
from: '2023-11-07T05:31:56Z',
to: '2023-11-07T05:31:56Z'
})
};
fetch('https://fleet.graviton.ma/api/v2/reports/generate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://fleet.graviton.ma/api/v2/reports/generate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'type' => 'latest_positions',
'from' => '2023-11-07T05:31:56Z',
'to' => '2023-11-07T05:31:56Z'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"success": true,
"data": {
"type": "<string>",
"generated_at": "2023-11-07T05:31:56Z",
"rows": [
{}
],
"count": 123
},
"meta": {
"request_id": "<string>",
"page": 123,
"per_page": 123,
"total": 123,
"pages": 123
}
}{
"success": false,
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
},
"meta": {
"request_id": "<string>",
"page": 123,
"per_page": 123,
"total": 123,
"pages": 123
}
}{
"success": false,
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
},
"meta": {
"request_id": "<string>",
"page": 123,
"per_page": 123,
"total": 123,
"pages": 123
}
}{
"success": false,
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
},
"meta": {
"request_id": "<string>",
"page": 123,
"per_page": 123,
"total": 123,
"pages": 123
}
}Authorizations
Your Graviton API token. Send Authorization: Bearer YOUR_API_TOKEN or Authorization: YOUR_API_TOKEN. Each token has individual permissions; a valid token without the permission required by the method and route returns 403 TOKEN_PERMISSION_DENIED.
Query Parameters
Use csv to download a CSV instead of JSON.
Available options:
csv Body
application/json

