-
Notifications
You must be signed in to change notification settings - Fork 3
Backend API development guidelines
Anna Zubenko edited this page May 4, 2017
·
1 revision
This is intended to be a collection of guidelines and best practices. The exact error response structure is under development.
Currently we support these types of responses:
- Success (
200 OK
or204 NoContent
(forDELETE
requests only)): entity or entity withwarnings
- Partial success (
200 OK
, consider 207 MultiStatus): entity witherrors
- Error (
400 BadRequest
or404 NotFound
):errors
list-
404 NotFound
must be returned for- absent routes
- absent entities requested with
GET
having entity identifier in URL (e.g.GET /v1/foos/:fooId
)
-
400 BadRequest
must be returned in any other case
-
Avoid (split into multiple) overly generic endpoints that
- have different behavior depending on optional attributes in payload
- require complex validation logic
Communication between core and UI. Client must be able to:
- render data based on successful response
- display error message or to build its own from error response
For thoughts on new error API, refer to this document
Communication between phoenix and other microservices that are not supposed to be called by UI. Phoenix must be able to:
- build an error response to client if microservice call was initiated by client request
- handle failure in other case (TODO: fill this in)