Command Access
The command handling manages the execution of commands. Commands cannot be added directly by the web service as they are managed by devices and their drivers.
Get All Commands
Gets a list of commands.
HTTP Method | GET |
HTTP Url: | nodes/command |
HTTP Query-Parameter: | - |
Request Content-Type | text/xml ; text/json |
Request Body | - |
Response Content-Type | text/xml ; text/json |
Response Content | Command argument list |
Example:
GET http://localhost:8081/nodes/command?id=f9a4300a-654b-42cf-9f54-f866184b7352
Get a Single Command
Gets the arguments and description of a command.
HTTP Method | GET |
---|---|
HTTP Url: | nodes/command |
HTTP Query-Parameter: | “id”: command id as System.Guid |
Request Content-Type | text/xml; text/json |
Request Body | - |
Response Content-Type | text/xml; text/json |
Response Content | Command argument list |
Example:
GET http://localhost:8081/nodes/command?id=f9a4300a-654b-42cf-9f54-f866184b7352
Response Body
<HumanOS.Stream>
<Command>
<Id>624771e2-7146-49b4-b13f-4876decada37</Id>
<Name>MyCommand</Name>
<Property>
<Name>ScriptFileName</Name>
<DataType>System.String</DataType>
<Value>TCommand_MyScript.cs</Value>
</Property>
<Argument name="Arg1" datatype="System.String" calltype="Input" description="First Argument"/>
<Argument name="Arg2" datatype="System.Int32" calltype="Input" description="Second Argument"/>
<Argument name="Retval" datatype="System.String" calltype="Output" description="Output"/>
</Command>
</HumanOS.Stream>
Executing Commands
Lists nodes within a specific group.
HTTP Method | POST |
HTTP Url: | nodes/command |
HTTP Query-Parameter: | id : command id as System.Guid |
Request Content-Type | text/xml ; text/json |
Request Body | Command arguments |
Response Content-Type | text/xml ; text/json |
Response Content | Result of the command including return codes and exceptions |
The argument list must match exactly to the command node arguments. Use the GET url to receive the list of arguments for a specific call before executing the command.
Example:
Request Body:
<HumanOS.Stream>
<Command>
<Argument name="Arg1" datatype="System.String">Content string</Argument>
<Argument name="Arg2" datatype="System.Int32">-982</Argument>
</Command>
</HumanOS.Stream>
POST http://localhost:8081/nodes/command?id=f9a4300a-654b-42cf-9f54-f866184b7352
Response Body:
<HumanOS.Stream>
<Command>
<Argument name="Retval" datatype="System.String">Out value</Argument>
<ReturnCode>Good</ReturnCode>
<Exception></Exception>
</Command>
</HumanOS.Stream>
Return Codes
Following codes are returned:
Return Code | Meaning |
---|---|
Good | Result is good |
GoodInProgress | Result not available yet. Processing is in progress |
BadAccessDenied | Access denied |
BadAddress | Invalid source address |
BadArguments | Invalid arguments |
BadConnection | No connection to the source or target object |
BadData | Data not available |
BadProcessing | Result is bad. Not processed |
BadLocked | Processing state is locked due to previous errors |
BadFatalError | Fatal error |
BadNotSupported | Not supported functionality |
BadNotImplemented | Functionality not implemented |
BadOutOfMemory | Out of memory |
BadNotActive | Data point not active |
Uncertain | Uncertain result, e.g. after interrupting a process |