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

Document everything - API errors #6

Open
ionutdobre opened this issue Sep 29, 2016 · 0 comments
Open

Document everything - API errors #6

ionutdobre opened this issue Sep 29, 2016 · 0 comments

Comments

@ionutdobre
Copy link

When it comes to documentation and also API implementation I would add something about documenting the API Errors:

  • what are the controlled errors that the API can return, for example: bad parameters, field name not found, no results matched your filters, etc…
  • what are the maintenance errors - example: you are (re)deploying the API so it will not be available for a short period of time
  • what are unrecoverable errors - for example: database crashed

Short example of API Error documentation

In case of an error (on client or server side), the API response will contain a JSON error body that provides: a useful error message, an error code, and the URL that caused the error. For example:

{
    "errors": [
        {
            "code" : "E01",
            "message": "Bad parameters. Please check the documentation for more informations."
            "url": "https://www.example.com/api/v1/sdgs?country=ro&item=123"
        }
    ]
}

Errors dictionary

  • E01 - at least one of the parameters is incorrect
  • E02 - ...
  • E03 - ...
@ionutdobre ionutdobre changed the title Document everything - errors Document everything - API errors Sep 29, 2016
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

No branches or pull requests

1 participant