This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
api-trucks-for-you [2018/08/02 10:56] hari [Response if request is successful] |
api-trucks-for-you [2018/08/02 11:01] hari [Response if request is successful, but there are no objects to return] |
||
---|---|---|---|
Line 1084: | Line 1084: | ||
{ ... more trips ... } | { ... more trips ... } | ||
] | ] | ||
+ | </code> | ||
+ | |||
+ | ==== Response when request is successful, but there are no trips ==== | ||
+ | |||
+ | Headers | ||
+ | <code> | ||
+ | HTTP/1.1 204 DONE | ||
</code> | </code> | ||
Line 1101: | Line 1108: | ||
+ | |||
+ | ==== Response for any other error ==== | ||
+ | |||
+ | Headers | ||
+ | <code> | ||
+ | HTTP/1.1 500 ERROR | ||
+ | Content-Type: text/plain | ||
+ | </code> | ||
+ | |||
+ | Body | ||
+ | <code> | ||
+ | Sample error message | ||
+ | </code> | ||
+ | |||
+ | |||
+ | ===== Admin: Create a new trip ===== | ||
+ | |||
+ | ==== Request ==== | ||
+ | |||
+ | API call | ||
+ | <code> | ||
+ | </code> | ||
+ | |||
+ | Headers | ||
+ | <code> | ||
+ | Authorization: Bearer user-token | ||
+ | Content-Type: application/json | ||
+ | </code> | ||
+ | |||
+ | Body | ||
+ | <code> | ||
+ | </code> | ||
+ | |||
+ | ==== Response if request is successful ==== | ||
+ | |||
+ | Headers | ||
+ | <code> | ||
+ | HTTP/1.1 200 OK | ||
+ | </code> | ||
+ | |||
+ | Body | ||
+ | <code> | ||
+ | </code> | ||
+ | |||
+ | |||
+ | ==== Response if token is invalid ==== | ||
+ | |||
+ | Headers | ||
+ | <code> | ||
+ | HTTP/1.1 401 INVALID-TOKEN | ||
+ | </code> | ||
+ | |||
+ | ==== Response if forbidden ==== | ||
+ | |||
+ | Headers | ||
+ | <code> | ||
+ | HTTP/1.1 403 FORBIDDEN | ||
+ | </code> | ||
+ | |||
+ | ==== Response if fields are missing or invalid ==== | ||
+ | |||
+ | Headers | ||
+ | <code> | ||
+ | HTTP/1.1 400 INVALID-<field-name> | ||
+ | Content-Type: text/plain | ||
+ | </code> | ||
+ | |||
+ | Body | ||
+ | <code> | ||
+ | Validation error specific to the error in the field | ||
+ | </code> | ||
+ | |||
+ | ==== Response if underlying objects don't exist ==== | ||
+ | |||
+ | Headers | ||
+ | <code> | ||
+ | HTTP/1.1 404 <object-type>-NOT-FOUND | ||
+ | </code> | ||
==== Response for any other error ==== | ==== Response for any other error ==== |