Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API should always respond with json data #212

Open
milafrerichs opened this issue Feb 25, 2021 · 0 comments
Open

API should always respond with json data #212

milafrerichs opened this issue Feb 25, 2021 · 0 comments

Comments

@milafrerichs
Copy link
Contributor

As a User of the API when there is a problem with the response I want to get a JSON response and get the error code instead of a server error.

We need to always catch server errors for the API and respond with a valid response and JSON.
This is how an example error could look like

{
  "error": {
    "message": "what did go wrong",
    "type": "Type of Execption (if applicable)",
    "code": 500,
  }
}

The easiest way to get started on this is to pick one Endpoint. e.g.:
https://staging.wazimap-ng.openup.org.za/api/v1/profile/10977/points/themes/?format=json
This already returns a not found but not in the format listed above.

After that, we need be sure that all instances where we can get a server error are caught.

@milafrerichs milafrerichs linked a pull request Mar 12, 2021 that will close this issue
15 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant