Write Tag API

Write Tag Data API enables you to create data for tags. You can write data to a tag for different data types such as integer, float, array, multifield and so on. Once created, you can view the data using other end points. Only REST API Administrator and users with write permission can perform this operation.

MethodPOST
URI
https://<historianservername>:8443/historian-rest-api
                /v1/datapoints/create
SAMPLE URI
https://<historianservername>:8443/historian-rest-api   /v1/datapoints/create

   Payload

   {
   "TagName": "GDW14NV2E.Simulation00015",
   "samples": [
                {
                   
                "TimeStamp": "2019-09-17T15:58:00.000Z",
                   
                "Value":   "1",
                   
                "Quality": 3
                }
           ]  
   }
SAMPLE RESPONSE

{

"ErrorCode": 0,

"ErrorMessage": ""

}

SAMPLE CURL COMMAND

curl -i -H "Accept: application/json" -i -H "Content-Type: application/json" -H "Authorization: Bearer <TOKEN>-d { \TagName\:\GDW14NV2E.Simulation00015\,\"samples\":[{\"TimeStamp\":\ "2019-09-17T15:58:00.000Z\",\"Value\": \"1\",\"Quality\": 3}]}-X POST https://<historianservername>:8443/historian-rest-api/v1/datapoints/create

Query Parameters

ParameterDescriptionRequired?Values
PayloadJSON format of Property Name and Property Value.YesMulti-data types. It can have integer, float, array, multifield data types.

Response Parameters

ParameterData TypeRequired?Description
Error CodeIntegerYesFor example, ErrorCode = 0, which means the operation was successful.
Error MessageStringYesFor example, NULL.

Sample Payload


{
"TagName": "Testt",
"samples": [
                {
                    "TimeStamp": "2019-09-24T05:00:00.000Z",
                    "Value": "{\"FD1\":\"true\",\"FD2\":\"101\"}",
                    "Quality": 3
                }
               
           ]  
}

Sample Response


{
    "ErrorCode": 0,
    "ErrorMessage": ""
}

Sample Payload


{
"TagName": "GDW14NV2E.Simulation000151",
"samples": [
                {
                    "TimeStamp": "2019-09-24T05:00:00.000Z",
                    "Value": "{\"FD1\":\"true\",\"FD2\":\"101\"}",
                    "Quality": 3
                }
               
           ]  
}

Sample Response


{
    "ErrorCode": 6,
    "ErrorMessage": "Tag doesn't exist"
}