GET
https://api.realtime.report/v1/tags/{id}
Authentication:
Get your tag data, this data includes the information of your tag
Parameters
INTEGER
Set the device of this tag. (required)
Response
Returns data of the tag
201
application/json; charset=utf-8
String
The id of the tag
String
The name of the tag
Bool
True if this is a setpoint and false if we have only read access.
Bool
True if this is an alarm and false if we have only read access.
Variable
The current value of this tag.
Besides the above default variables you will also get protocol specific variables. We use the 'Siemens' protocol in this example.
string
The addres of the tag in the PLC. (E.g. DB.dbx3.2)
string
Stored in the 'memory' or in a 'database'
Integer
If the tag is stored in a database, you will get the number of this database.
String
The type tag (E.g. INT, DINT, REAL or BOOL)
Integer
The offset of the type
Integer
If the type is an bool, you can set an bit_offset .
Example
/*
* Example get tag - How to get tag information from the API
* https://api.realtime.report/v1/tags/{id}
*/
try {
/*
* Initialize the RealtimeReporter API SDK with your API key.
* See: https://realtime.report/developer
*/
require_once $_SERVER['DOCUMENT_ROOT'].'/vendor/autoload.php';
$reporter = new reporter_api ;
$reporter->set_api_key('YOUR API KEY');
/*
* Parameters:
* device_id : Int
*/
$data = array();
$data['device_id'] = 3244 ;
/*
* All data is returned in a tag opject
*/
$tag = $reporter->get_tag('tag_id', $data);
/*
* In this example we print the data in json format on the page
*/
echo "Tag data";
echo json_encode($tag, JSON_PRETTY_PRINT);
} catch (Exception $e) {
echo "API call failed: " . htmlspecialchars($e->getMessage());
}
Response example
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"id": "82449b8e92eb4f678707",
"name": "Valve open",
"is_setpoint": true,
"is_alarm": false,
"value": true,
"Address": "DB.dbx3.2",
"Location": "database",
"db_number": "1",
"type": "BOOL",
"offset": "3",
"bit_offset": "2"
}
Response Error
Returns an array with error information
230
application/json; charset=utf-8
Integer
The error code listed in a list below
String
The error message listed in a list below
Error Codes
1000
1001
1000
1001