Status Codes

aXAPI uses three categories of HTTP status codes - 2XX, 4XX, and 5XX.

  • 2XX indicates success of request.
  • 4XX indicates client side error. For example, if the JSON data is incorrect.
  • 5XX indicates server (ACOS device) side error.

Status Code List

The returned set of status codes may keep evolving but its basic categories and meanings are as follows:

200 OK

This response indicates success and also returns a response message. The response format could be JSON data, plain text, or octet binary data.

For example:

GET /axapi/v3/interface/Ethernet/1 returns JSON data.
POST /axapi/v3/clideploy with a show command returns plain text.
GET /axapi/v3/file/ssl-cert returns a pem file or zipped file.

201 CREATED

This response is the same as 200 OK with an indication that a new resource or record has been created.

204 NO CONTENT

This response indicates success without any response data. In this case, the client has no need to parse any data. Normally, operational APIs have no response data for the client to read and the 204 status code is returned to indicate the operation is executed successfully.

For example, to import a file:

POST /axapi/v3/file/aflex

202 ACCEPTED

This response indicates that the request has been accepted and there is no error for now, but the action is still in process. Normally, this status code is returned for time-consuming tasks such as upgrading. In this case, the client might need to periodically check status.

400 BAD REQUEST

This response indicates that the API does not understand the request. Incorrect JSON syntax and not matching schemas may cause this response. All JSON properties are defined by a schema file. The client needs to follow the schema definition to send a request. For example, ip-address is defined as string but if the client issues it as a number, this error may be caused.

401 UNAUTHORIZED

This response indicates that the request is from an untrusted client and authentication is required. In this case, the client would need to authenticate itself and resend the request. Authentication URI /axapi/v3/auth

403 FORBIDDEN

This response indicates that the client does not have sufficient privileges for such a request. The relative cases include RBA control, platform control, and license control.

404 NOT FOUND

This response indicates that the requested records do not exist or the APIs are not supported. For example, GET /axapi/abc/def has no definition attached to it.

415 UNSUPPORTED MEDIA TYPE

This response indicates that the client sends the request with the wrong data format which cannot be accepted by the ACOS device. For example, if the ACOS device can only accept “application/json” and the client sends “plain/text”.

500 INTERNAL SERVER ERROR

This response indicates that because of a server side error the request cannot be processed. For example, the system is down or the system resources are used up.