REST API

Log tags

POST
https://api.realtime.report/v1/logs/tags

Authentication: API Key

Add multiple tags to the logs at once, there is a maximum of 100 tags per request.

Parameters

device_id
INTEGER
Set the device of the tag. (required)
tags
Array
Array with tag_id, datetime and the value

Response

Returns data of the tag

201
application/json; charset=utf-8
id
String
The id of the log
value
String
The value that is logged

Example


/*
* Example get tag - How to get tag information from the  API
* https://api.realtime.report/v1/logs/tag
*/
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');

    /*
	* Set the new values
	*/

	$tags_data = array();
	$tags_data['device_id'] = 123 ;

	$tag_data = array();
	$tag_data['tag_id'] = 're4ray34674ydgw21';
	$tag_data['datetime'] = time();
	$tag_data['value'] = 23444 ;

	$tags_data['tags'][] = $tag_data ; 

	$tag_data = array();
	$tag_data['tag_id'] = 'dfg456desfgsdfg4';
	$tag_data['datetime'] = time();
	$tag_data['value'] = 777 ;

	$tags_data['tags'][] = $tag_data ; 

	/*
	* Update the tag value
	*/
    $log = $reporter->log_tags($tags_data);

    /*
    * In this example we print the data in json format on the page
    */
    echo "Log data";
    echo json_encode($log, 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",
    "value": "23444" 
}

Response Error

Returns an array with error information

230
application/json; charset=utf-8
code
Integer
The error code listed in a list below
message
String
The error message listed in a list below

Error Codes

1000
No valid API key
1001
No tag found
1001
No device found