The NSight API returns standard HTTP status codes in addition to JSON-based error codes and messages in the response body.
HTTP Response Status Codes
| Code | Description |
|---|---|
| 200 OK | The request was successful |
| 201 Created | The resource was created successfully |
| 204 No Content | Success with no response body |
| 400 Bad Request | The operation failed because the request is syntactically incorrect or violated schema |
| 401 Unauthorized | The authentication credentials are invalid or the user is not authorized to use the API |
| 404 Not Found | The server did not find the specified resource that matches the request URL |
| 405 Method Not Allowed | The API does not support the requested HTTP method |
If an API request is successful, the response looks similar to the following example:
{
"success" : true,
"data" : <some data> - if the call returns data,
"return_code": 0
}
If an API request cannot be completed or results in an error, the response looks similar to the following example:
{
"success" : false
"errors": <error description>,
"return_code": 1
}