Skip to content

Improve API error handling #4587

@SlowMo24

Description

@SlowMo24

While using the API I experienced the following inconveniences that might be worth improvement:

  • the API response with an HTML page on faulty requests. Although that is ok-ish, it means I have to write the response to a file and open that in my browser to get the error message. Responding in a more common manner with the correct HTTP status code and a json response may be preferable. The response could still contain a link to the error page for humans, if needed.
  • when sending a faulty POST request to the /incidents endpoint (e.g. with an invalid data like below), I get redirected to root and the final error only tells me that POST is not allowed for / which is confusing: Image

example invalid data that will spawn the redirection to root:

{
  "name": "<string>",
  "status": 0,
  "message": "<string>",
  "template": "<string>",
  "visible": false,
  "stickied": false,
  "notifications": false,
  "occurred_at": "<string>",
  "template_vars": [],
  "component_id": 123,
  "component_status": 1
}

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions