Response errors

While making requests to the SAYMON API, you may encounter some errors. This article contains a description of all such errors, the reasons that might lead to these errors, and possible ways to address them.

400 Bad Request

This error happens when you provide invalid request parameters. An example is an incorrect JSON body. In such a case, a response will be similar to this:

{
"code": "InvalidContent",
"message": "Invalid JSON: Unexpected token @ in JSON at position 42"
}

Another example is when you miss one of the mandatory query parameters. In this case, you will get the following:

{
"code": "BadRequest",
"message": "Mandatory \"metrics\" parameter is absent/empty."
}

A description inside the message field might be useful to figure out how to fix the happened error.

401 Unauthorized

This error means that something went wrong while authentication. There are several reasons that might lead to this error.

Not logged in

One of them — you don't utilize authentication at all. In such a case, a response body will look like this:

{
"code": "Unauthorized",
"message": "{\"errorCode\":3,\"message\":\"Not logged in.\"}"
}

Session expired

If you apply the Session Authentication scheme but a session ID doesn't exist or was already deleted, you will get the same 401 error with this body:

{
"code": "Unauthorized",
"message": "{\"errorCode\":3,\"message\":\"Session expired.\"}"
}

Invalid login or password

In case you utilize Basic Access Authentication but your login or password contains a typo, a response will look like this:

{
"code": "InvalidCredentials",
"message": "{\"errorCode\":3,\"message\":\"Invalid login or password.\"}"
}

Invalid API token

When you use Token Authentication and a token doesn't exist or was deleted, you will get the following error:

{
"code": "Unauthorized",
"message": "{\"errorCode\":3,\"message\":\"Invalid API token.\"}"
}

If you encounter one of these errors, check if your login credentials are correct or make sure that a session ID/token was not deleted and is still valid.

403 Forbidden

This error occurs if you try to make a request to a method but don't have required permissions. In such a case, a response body will be similar to this:

{
"code": "NotAuthorized",
"message": "User doesn't have required permission (expected one of: modify-objects, manage-objects)."
}

The message field describes what permissions you need to have to make requests to this method.

If you encounter this error, ask an administrator to check whether you have the required permissions and active them if necessary.

404 Not Found

This error happens when you try to make a request to a method that requires the ID of some item to be specified but the item with this ID doesn't exist. In such a case, a response will be similar to this:

{
"code": "ResourceNotFound",
"message": "Entity not found: User(42)"
}

If you encounter this error, make sure that the requested item indeed exists and its ID is correct.