As to the REST service of SuperMap iServer, there are two methods for the passing of the HTTP request parameters.
- URI query parameters: Parameters passed through the URI.
- Request body parameters: Parameters passed in the entity-body.
Below is the demonstration for passing parameters with the two methods.
Parameter name | Parameter value (Json) | Parameter value (XML) |
A |
value_a | Value_A |
B |
value_b | Value_B |
1 URI query parameters
URI query parameters are placed at the end of the URI absolute path, beginning with "?", in the form of "parameter name = parameter value", separated with "&", listed in no particular order. The URI is as follows:
http://supermapiserver:8090/iserver/services/components-rest/rest/sample.json?A=value_a&B=value_b
where A and B are parameter names corresponding to the parameter values value_a and value_b.
Note: The value of URI query parameter can only be in JSON format.
2 Request body parameters
Request body parameters are parameters passed in the entity-body. The request body parameters can be in both JSON or XML format.
The server judges the type of the request body parameter by the X-RequestEntity-ContentType header in the HTTP request, and parses the parameters based on the result. If X-RequestEntity-ContentType is application/json, the server considers the format of the request body parameter as JSON; if it is application/xml, the format will be considered as XML. If X-RequestEntity-ContentType doesn't exist, the format will be considered as JSON by default.
JSON format:
{"A":value_a,"B":value_b}
XML format:
<Object>
<A>Value_A</A>
<A>Value_A</A>
</Object>