13. Nagłówki i Statusy
200 OK
201 Created
202 Accepted
204 No Content
304 Not Modified
400 Bad Request
401 Unauthorized (Unauthenticated)
403 Forbidden
404 Not Found
405 Method not Allowed
409 Conflict
429 Too Many Request
17. Błędy
{
“error”:”1”,
“message”:”An error occurs”
}
"2000": {
"httpCode": 400,
"internalCode": 2000,
"developerMessage": "Your request has incorrect format.",
"codeDescription": "Cannot understand this request, please check if all mandatory field are filled",
"moreInfo": "http://dev.example.com/erros/2000",
"context": ["Field email must have valid email address!", "You must specify campaignId"]
},
18. Podsumowanie
Pamiętaj że klientami twojego API są programiści,
Nie zaniedbuj czytelności API zwłaszcza w wypadku
błędów,
Wykorzystuj standardy,
Zachowuj kompatybilność wsteczną i zaplanuj długie
cykle życia wersji,
Planuj strukturę reprezentacji zasobów (enveloping),
Rozmawiaj ze swoimi klientami!