Errors

If there was an error, an appropriate status code will be set. Data will be sent with the format in the form of:

{
  "message": "Text explaining the error",
  "info": "Supplementary information about error. Optional",
  "detail": "Debug or stacktrace about the error. Optional. Will not be sent if include_error_detail=0"
}

Note

The content returned maybe in a different format than the one requested. For instance, invalid data structures (400 bad request) could return content-type text.

The Rest API may only return part of the error text; full details of the error will always be logged to the backend log file. To enable more detailed error information to be returned to the caller, add the following lines to your opsview_web_local.yml file and restart opsview-web (you will need to add to deploy’s user_vars to make this permanent):

ControllerBase::REST:
  include_error_detail: 1

Note

Enabling more detail could reveal environmental information about your system to users. For maximum security, this value should be left at the default 0.

Common errors Copied

400: Bad Request Copied

This can mean that the input parameters can not be parsed. There should be more information in the content.

If the contents shows:

    Content-Type application/json had a problem with your request.
    ***ERROR***
    malformed JSON string, neither array, object, number, string or atom, at character offset 180 (before "],\n      "all_servi...") at <$fh> line 21.

Then this means there is some invalid JSON data. JSON input is set to “relaxed”, so additional commas at end of lists are valid.

If you have violated a constraint set on a specific field, you could need to modify the characters you are trying to insert. See Interacting with Opsview for more details.

["Opsview On-premises"] ["API", "Technical Reference"]

Was this topic helpful?