HTTP Methods and Responses
The Secure Network Analytics APIs use conventional HTTP request methods and response codes to indicate the success or failure of an API request. In general, codes in the 2xx range indicate success. Codes in the 4xx range indicate an error that resulted from the provided information. Codes in the 5xx range indicate an error with our servers.
HTTP Requests
Use standard HTTP requests to access the Secure Network Analytics REST API. The methods remain consistent across all resources and should be fairly familiar to anyone who has used other REST APIs.
| Desired Option | HTTP Method |
|---|---|
| Read | GET |
| Create | POST |
| Update | PUT |
| Delete | DELETE |
NOTE: Not all resources support all HTTP methods. For example, some resources may only support GET.
HTTP Responses
If the operation succeeded, expect a standard 200 OK response. You should always check the Status-Code field in the HTTP header. If it is anything other than 200, then the operation failed. The error codes are in the following table:
| Status Code | Description |
|---|---|
| 400 Bad Request | General error when fulfilling the request that would cause an invalid state, for example, domain validation errors or missing data. |
| 401 Unauthorized | Error code response for missing or invalid authentication token. It indicates that you can retry the request once you acquire a valid authentication token. Refer to How to Authenticate for more information. |
| 404 Not Found | Use this when the service does not find the requested resource. This could happen because the resource does not exist or, for security reasons, the service wants to mask its existence. |
| 405 Method Not Allowed | A request was made of a resource using a request method that is not supported by that resource, for example, using GET on a write-only resource or using PUT on a Read-only resource. |
| 500 Internal Server Error | Catch-all error when the server-side has an exception. In the event of a failure, the response body contains a JSON response that should contain more information about what caused the operation to fail. |
NOTE: The Secure Network Analytics REST API returns HTTP responses in JSON format only.