Request to the Web Service

<< Click to Display Table of Contents >>

 

Request to the Web Service

HTTP requests to the Web Service must use the POST method and include the required parameters Operation, Entity, and Data. The Data parameter must be in XML or JSON format, according to the next specification.

 

General Structure

Except for the UPDATE TAG operation, the request parameters are encapsulated in a reserved Block Tag called OperationBlock. For requests with the UPDATE TAG operation, the Block Tag OperationBlock is not used, since this operation is intended for updating specific PLC or Block Tags. In this case, the Entity parameter represents the Tag's Item property to update and the Data parameter must follow the formats described next.

 

For PLC Tag Updates

XML format:

<TagData>
  <Value>XXX</Value>
  <Quality>XXX</Quality>
  <Time>XXX</Time>
</TagData>

 

JSON format:

{
  "Value": "XXX",
  "Quality": XXX,
  "Time": "XXX"
}

 

For Block Tag Updates

XML format:

<TagData>
  <Values>
    <Value>XXX</Value>
    <Value>XXX</Value>
    <Value>XXX</Value>
  </Values>
  <Quality>XXX</Quality>
  <Time>XXX</Time>
</TagData>

 

NOTE

The <Values> section can contain as many <Value> elements as needed.

 

JSON format:

{
  "Value": ["XXX", "XXX", "XXX"],
  "Quality": XXX,
  "Time": "XXX"
}

 

NOTE

The Value array can include as many values as needed.

 

Rules for Values

Value: The values sent are interpreted by the application as Strings, integer, or floating point values, depending on the most appropriate format

Quality: Must be an integer value representing the quality of a Tag, such as 192 for good quality

Time: Must be a String in ISO 8601 format, using the pattern YYYY-MM-DDTHH:MM:SS, such as "2025-06-13T17:25:56"

 

Specific Behavior

If a POST request to update a Block Tag is sent, but the Entity parameter refers to a PLC Tag in the application, only the first value from the array or list of values is considered for updating that Block Tag.

 

Example of a Request Using the curl Program

curl -X POST http://localhost:5050/ \
  -H "Content-Type: application/json" \
  -H "Operation: XXX" \
  -H "Entity: XXX" \
  -d "XXX"

 

The value of the Content-Type header must match the format of data sent in the body, that is, the -d parameter. Use "application/json" if data is in JSON format and "application/xml" if data is in XML format.

The request's response is a String in JSON format with the Err field, an integer representing the error code, and the ErrMsg field, a String containing a description of the error.

 

Example of a Response

{"Err":3,"ErrMsg":"Invalid XML or JSON data"}

Was this page useful?