Status Codes


HTTP Status codes are returned by the server to the client software to determine the outcome of a request. For instance, whether the request is successfully handled, the cause for the error, etc.

The HTTP protocol defines 41 status codes in 5 categories:

SuperMap iServer mainly includes the status codes of the 2xx, 4xx, and 5xx classes, as described below.

Status code Description

200

Standard response for successful HTTP requests.

The actual response will depend on the request method used. For instance, GET an entity corresponding to the requested resource is sent in the response; HEAD the entity-header fields corresponding to the requested resource are sent in the response without any message-body; POST an entity describing or containing the result of the action; TRACE an entity containing the request message as received by the end server.

201

The request has been fulfilled and resulted in a new resource being created. The corresponding request methods include POST and PUT.

The newly created resource can be referenced by the URI(s) returned in the entity of the response, with the most specific URI for the resource given by a Location header field.

303

The server redirects the request to another URI. To complete the rquest, further operations need to be performed.

For example, when accessing the image image resource, if the redirect parameter is true, it indicates the image will be redirected. The URI is as follows:

http://supermapiserver:8090/iserver/services/map-world/rest/maps/WorldMap/image.png?center={"x":103,"y":34}&scale=0.00000002&redirect=true

The status code of the HTTP response is 303 and the server redirects to the image URI.

400

The request could not be understood by the server due to malformed syntax.

For instance, 400 is returned in such situation that, when you implement the POST request on the layers resource to create a new layer (layer resource), but you didn't specify the parameters needed in the request body.

401

The request requires user authentication.

For instance, you can implement the DELETE request (with parameters included) on the dataset resource with the URI, shown as below:

http://supermapiserver:8090/iserver/services/data-world/rest/data/datasources/name/World/datasets/name/Countries.rjson

However, if the client has no admin permission needed for creating a new layer, 401 will be returned.

404

The server has not found anything matching the Request-URI.

For instance, when you implement the GET request on the World map resource with the URI below:

http://supermapiserver:8090/iserver/services/components-rest/rest/maps/World.json

200 will be returned if the request is successfully handled. However, 404 will be returned if there is no map resource named World on the server.

405

The method specified in the Request-Line is not allowed for the resource identified by the Request-URI.

For instance, 405 will be returned if you implement the PUT or DELETE request on the maps resource, which indicates that the maps resource doesn't support the PUT and DELETE methods.

406

The resource requested is only capable of generating response entities which have content characteristics not specified in the accept headers sent in the request (Please see the output formats supported in SuperMap iServer REST API).

For instance, when you implement the GET request on the URI below to get the maps resource:

http://supermapiserver:8090/iserver/services/components-rest/rest/maps.bmp

406 will be returned because the maps is not the image resource, therefore doesn't support the BMP format.

500

The request was unsuccessful due to an unexpected condition encountered by the server.