Xentara WebSocket API Specification v2.0.3
User Manual
Write Command

Command

OpCodeNameDescription
5writeWrite the value to an attribute of a Xentara Element.

Parameters

The parameter object outlined in request packet for this command includes:

IDNameOptionalDescription
0element_uuidnoA UUID specifying the UUID of the Xentara element.
1attribute_idnoA value consisting of either an integer or a UUID, drawn from the attributes identifiers list or the Xentara attribute UUID.
2attribute_valuenoA data value of the appropriate datatype corresponding to the described attribute that needs to be written.
3sub_session_idyesA UUID specifying the UUID of the opened sub-session. If the sub-session ID is not provided, access is verified based on the authorization of the WebSocket connection. If provided, access is verified based on authorization of both, the WebSocket connection and the authentication method utilized for opening a sub-session.

Response

In case of successful execution, the response item indicated in response packet contains no elements. It simply includes the successful response packet type and the message id. If an error occurs, the response will include an error packet with detailed error information.

Errors

Below is the list of the potential errors that may be encountered with this command. Further details regarding errors in the Xentara WebSocket interface can be accessed here.

Sr. No. Error Code Error Description
1 -32700 Parse Error
2 -32603 Internal Error
3 -32602 Invalid Parameter
4 -32600 Invalid Request
5 -32000 Missing Client Hello Request
6 -32100 Unknown Element
7 -32101 Missing Attribute
8 -32102 Access Denied
9 -32103 Read Only
10 -32105 Value Out Of Range
11 -32106 Type Mismatch
12 -32107 Illegal Value
13 -32109 Write Error

Examples

Request

Below is an example of a request to write the boolean value of attribute, represented as attribute identifier, for the element with the UUID "e3ee1071-4d88-4ba1-8e5d-0f1e4ce25ee8". The message id 65 is an arbitrary number assigned for this particular request.

[
  0,                                            # Request Packet
  65,                                           # Message Id
  5,                                            # Write OpCode
  {                                             # Write Object
    0: 37('88130CE8B9E74A2A8F26D32A931129AA'),  # Xentara Element UUID
    1: 11,                                      # Attribute Identifier
    2: true,                                    # Attribute Value
    3: 37('E3EE10714D884BA18E5D0F1E4CE25EE8')   # Opened Sub-Session Id
  }
]

Response

Below is an example of a successful response to the mentioned request, indicating that the value is wriiten to requested attribute. It features a package type of 1, representing a successful response. The included Message ID is used for matching with the corresponding request.

[
  1,         # Packet Type - Success Response
  65         # Message Id
]