93
General format for a call using HTTP Post:
[version=[ RPC Server Version ]&]method=[ Method to Call ][&encoding=[
Count ]][¶m1=[ Value for Parameter 1 ]¶m2=[ Value for Parameter 2
]¶m3=[ Value for Parameter 3, etc...]]
See the detailed list of methods at the end of this reference for the method name and the values for
param1, param2, etc. These parameter values are denoted by the text “
[in]
” in the Syntax and
Parameters sections.
Response Tokens
Response Tokens
Response Tokens
Response Tokens
The response tokens are:
•
status - 0 for Failure, 1 for Success
•
faultCode - If status is 0 (failure). faultCode will be an integer representing a specific error
(
see Fault Codes
). This token is NOT returned if status is 1 (success).
•
response[i] - Returned value #i, where i is an integer. If status is 0 (fail), the value for
response1 will be a string describing the failure, and the value for response2 will be a debug
string giving more information about the failure.
Returned values are strings, integers, or Booleans, depending on the method. See the detailed list of
methods at the end of this reference for details about the returned values for any given method. These
returned values are denoted by the text “
[out, retval]
” in the Syntax and Parameters sections.
The response to the HTTP Post will be a string in the format:
status=[ 0 or 1 ][&faultCode=[Fault Code]] [&response1=[ Value for
Response 1 ] &response2=[ Value for Response 2 ] &response3=[ Value for
Response 3, etc...]]
EXAMPLE #1: Serial_GetSettings
EXAMPLE #1: Serial_GetSettings
EXAMPLE #1: Serial_GetSettings
EXAMPLE #1: Serial_GetSettings
Let us look at the method
Serial_GetSettings
(defined on page
113
). From the Syntax and
Parameter sections, we can tell that
param1
is a long integer that specifies either serial port #1 or #2.
We can also see that
response1
(retval, or return value) is a string describing the settings for the given
port.
Using the HTTP Post format, the call to obtain settings from serial port #2 is:
version=2.0&method=Serial_GetSettings¶m1=2
Since the version token is optional, this call may be simplified:
method=Serial_GetSettings¶m1=2
A sample response for this call:
status=1&response1=9600,8,ODD,2,1,SOFTWARE
Responses are not usually used in its raw string format. A web programmer will typically parse the
response before displaying or otherwise making use of the information received.