Getting Reports
Getting Reports Bloc
Please Note: All Bloc Data User Restrictions will apply in these requests. If you are not getting data back or cannot access the bloc, please make sure the user who the Auth token was created for is not restricted to certain data, and please also make sure they have been given access to that bloc.
Returns the data as a blob that can generate an excel file or just as json data
GET
https://example.mydomain.com/api/get-data-report
Request Body
{
"data": {
"0": {
"created_at": "2022-05-22 22:05:01",
"submitted_status": 1,
"user_id": "johndoe",
"field_1": "data",
"field_2": "more data",
"cartolytics_entry_row_id": 123456
},
"1": {
"created_at": "2022-05-22 22:06:03",
"submitted_status": 1,
"user_id": "johndoe",
"field_1": "another record",
"field_2": "more data",
"cartolytics_entry_row_id": 123457
},
"2": {
"created_at": "2022-05-22 22:07:53",
"submitted_status": 1,
"user_id": "johndoe",
"field_1": "another record",
"field_2": "more data",
"cartolytics_entry_row_id": 123458
},
"3": {
"created_at": "2022-05-22 22:08:41",
"submitted_status": 1,
"user_id": "johndoe",
"field_1": "another record",
"field_2": "more data",
"cartolytics_entry_row_id": 123458
}
"count": 4,
"fieldCounts": {
"field_1": {
"another record": 2,
"data": 1
},
"field_2": {
"more data": 4
},
},
"countLimitInfo": {
"scan_limit": null,
"scan_limit_time_logged": null,
"scans_counted": 5,
"limit_reached": 0
},
"fieldNames": {
"field_1": "Field 1",
"field_2": "Field 2"
}
}
}
{
"error": "You are not authorized to access this bloc"
}
{
"error": [ERROR MESSAGE HERE]
}
<?php
$dataFilteringData = array(
'stationID' => 1234,
'resultLimit' => null,
'filterDataToQuery' => array(
'field_1' => array(
'Value1',
'Value2'
),
'blocworx_free_search' => array(
'Another Value'
)
),
'currentPage' => 1,
'reverse' => false
);
$requestedReportData = array(
'reportFromDate' => '2022-11-04 00:00:00',
'reportToDate' => '2023-03-11 23:59:59'
);
$fieldsToReport = array(
'field_1' => true,
);
$data = array(
'dataFilteringData' => json_encode($dataFilteringData),
'fieldsToReport' => json_encode($fieldsToReport),
'requestedReportData' => json_encode($requestedReportData),
'stationID' => 1234
);
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://example.mydomain.com/api/get-data-report',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_POSTFIELDS => json_encode($data),
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer [AUTHTOKEN]',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var dataFilteringData = {
'stationID': 1234,
'resultLimit': null,
'filterDataToQuery': {
'field_1': ['Value1', 'Value2'],
'blocworx_free_search': ['Another Value']
},
'currentPage': 1,
'reverse': false
};
var requestedReportData = {
'reportFromDate': '2022-11-04 00:00:00',
'reportToDate': '2023-03-11 23:59:59'
};
var fieldsToReport = {
'field_1': true
};
var data = {
'dataFilteringData': JSON.stringify(dataFilteringData),
'fieldsToReport': JSON.stringify(fieldsToReport),
'requestedReportData': JSON.stringify(requestedReportData),
'stationID': 1234
};
$.ajax({
url: 'https://example.mydomain.com/api/get-data-report',
type: 'GET',
data: data,
headers: {
'Authorization': 'Bearer [AUTHTOKEN]',
'Content-Type': 'application/json'
},
success: function(response) {
console.log(response);
},
error: function(error) {
console.log(error);
}
});
const axios = require('axios');
const dataFilteringData = {
'stationID': 1234,
'resultLimit': null,
'filterDataToQuery': {
'field_1': ['Value1', 'Value2'],
'blocworx_free_search': ['Another Value']
},
'currentPage': 1,
'reverse': false
};
const requestedReportData = {
'reportFromDate': '2022-11-04 00:00:00',
'reportToDate': '2023-03-11 23:59:59'
};
const fieldsToReport = {
'field_1': true
};
const data = {
'dataFilteringData': JSON.stringify(dataFilteringData),
'fieldsToReport': JSON.stringify(fieldsToReport),
'requestedReportData': JSON.stringify(requestedReportData),
'stationID': 1234
};
axios({
method: 'get',
url: 'https://example.mydomain.com/api/get-data-report',
params: data,
headers: {
'Authorization': 'Bearer [AUTHTOKEN]',
'Content-Type': 'application/json'
}
})
.then(response => {
console.log(response.data);
})
.catch(error => {
console.log(error);
});
import json
import requests
dataFilteringData = {
'stationID': 1234,
'resultLimit': None,
'filterDataToQuery': {
'field_1': ['Value1', 'Value2'],
'blocworx_free_search': ['Another Value']
},
'currentPage': 1,
'reverse': False
}
requestedReportData = {
'reportFromDate': '2022-11-04 00:00:00',
'reportToDate': '2023-03-11 23:59:59'
}
fieldsToReport = {
'field_1': True
}
data = {
'dataFilteringData': json.dumps(dataFilteringData),
'fieldsToReport': json.dumps(fieldsToReport),
'requestedReportData': json.dumps(requestedReportData),
'stationID': 1234
}
headers = {
'Authorization': 'Bearer [AUTHTOKEN]',
'Content-Type': 'application/json'
}
response = requests.get('https://example.mydomain.com/api/get-data-report', headers=headers, params=data)
print(response.text)
Last updated