HTTP Status Codes
All HTTP commands respond with a status code that identifies if the client or server encountered any protocol
or URL mapping issues. For the command to proceed (for example, return valid data), the HTTP status code
must display the value 200 (HTTP_OK). Any other HTTP response code indicates an error and the data
content will not be received. That is, if the client expects an XML (or JSON) response, then it must first check
that the HTTP status code in the HTML header of the response is 200.
For client software or debugging purposes, you may want to dump the HTTP response header (which shows
the status code) via the
curl -i
parameter.
The following is an example of an invalid command for which HTTP 404 error is returned:
curl -i -k -H "X-SESSION-ID: $token" -X POST"https://192.168.0.1/ws/v2/invalid_command
HTTP/1.1 404 Not Found
Date: Fri, 23 Oct 2015 19:26:40 GMT
Server: Hiawatha v9.14
Connection: keep-alive
Transfer-Encoding: chunked
Status: 404
The following is a list of the common HTTP return codes when communicating with D9800 (refer to RFC-1945
for the full list and descriptions):
200_HTTP_OK
400_HTTP_BAD_REQUEST
401_HTTP_UNAUTHORIZED
403_HTTP_FORBIDDEN
404_HTTP_NOT_FOUND
500_HTTP_INTERNAL_SERVER_ERROR
501_HTTP_NOT_IMPLEMENTED
502_HTTP_BAD_GATEWAY
503_HTTP_SERVICE_UNAVAILABLE
504_HTTP_GATEWAY_TIMEOUT
505_HTTP_VERSION_NOT_SUPPORTED
Content Response Types
When HTTP status code is HTTP_OK (value 200), there are two types of content responses available:
1
application/xml
2
application/json
When not specified, the response content is returned in XML format.
When js=1 is specified as an appended "&" parameter, then the response is returned in JSON format.
When a legacy API (for example, backup, restore_upload, cdt_upload, diagnostics) is being called, the response
may be in command specific XML or HTML format only and does not support the Generic Response XML
format or Json (js=1) options. Refer to the commands for specific descriptions.
Cisco D9800 Network Transport Receiver Version 2.75 RESTful Web Services API Reference Guide
5
Web Services API
HTTP Status Codes