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 this case, a response would look like this:

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

This error can also occur when you don’t include 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 during authentication. Several reasons might lead to this error.

Not logged in

This error can occur if you don’t use authentication at all. In this 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

If you use Basic Access Authentication but your login or password are incorrect, a response will look like this:

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

Invalid API token

When you use Token Authentication, but 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 wasn’t 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 this case, a response body will look like 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 you to specify the ID of an item, but the item with this ID doesn’t exist. In this case, a response will look like this:

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

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

409 Conflict

This error happens when you provide an invalid request body (for example, you don’t specify a required field).

The following example is an error message that occurs if you don’t specify the name parameter in the Create Class request.

{
    "code": "InvalidArgument",
    "message": "Field name required, entity=Class(undefined)"
}