To list JobData database contents, use the GET route /application/jobdata/tables/:guid/datasets. The table is identified through your GUID (Parameter guid).
The return value is in JSON format:
{
"meta": {
"pagination": {
"total": 159 // Number of data records in the table
}
},
"datasets": [
{
"jrid": "1",
"username": "jdoe",
"registered": "2017-08-21T12:34:57+01:00"
},
... further data records ...
]
}
If you are using the GET parameter withListDisplayValues and the option Display value in overview is checked in the configuration of a list column, the display value will also be returned. In this case the GET route /application/jobdata/tables/:guid/datasets?withListDisplayValues has the following structure:
{
"meta": {
"pagination": {
"total": 159 // Number of data records in the table
}
},
"datasets": [
{
"jrid": "1",
"username": {
"name": "John Doe",
"value": "jdoe"
},
"registered": "2017-08-21T12:34:57+01:00"
},
... further data records ...
]
}
Example: List data records
guzzlehttp
// User has been authenticated already
try {
// Determine data records
$response = $client->request(
'GET',
'application/jobdata/tables/2076E38C-3EC0-234E-EFFD-E15F14879CB1/datasets'
);
echo "Status code: " . $response->getStatusCode() . "\n\n";
$body = json_decode($response->getBody(), true);
echo "Number of data records: " . $body['meta']['pagination']['total'] . "\n\n";
// List data records
foreach ($body['datasets'] as $dataSet) {
foreach ($dataSet as $columnName => $columnValue) {
echo $columnName . ": " . $columnValue . "\n";
}
echo "\n";
}
} catch (Exception $e) {
echo "Error during performance: " . $e->getMessage() . "\n";
}
// Finish user session
cURL
// User has been authenticated already
curl_setopt($curlHandle,
'http://example.org/jobrouter/api/rest/v2/application/jobdata/' .
'tables/2076E38C-3EC0-234E-EFFD-E15F14879CB1/datasets');
curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curlHandle, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($curlHandle, CURLOPT_COOKIEFILE, 'path/to/cooke/file.cookie');
// Create data record
$response = curl_exec($curlHandle);
$statusCode = curl_getinfo($curlHandle, CURLINFO_HTTP_CODE);
curl_close();
if ($statusCode == 200) {
// Display response
$data = json_decode($response, true);
foreach ($data['datasets'] as $dataSet) {
foreach ($dataSet as $columnName => $columnValue) {
echo $columnName . ": " . $columnValue . "\n";
}
echo "\n";
}
} else {
echo "Error during performance: Code - " . $statusCode . ", ";
echo "Response: " . var_export($response, true);
}
// Finish user session