3 ms·
Some things that irk me: 0. JSON. Use JSON. 1. Version your API 2. Any numerical value whose precise value you care about, send as a string. 3. Any ID shoul
by angersock 12y ago
Some things that irk me:
0. JSON. Use JSON.
1. Version your API
2. Any numerical value whose precise value you care about, send as a string.
3. Any ID should be sent as a string.
4. Any timestamp should be sent as RFC3339 UTC.
5. Any data whose numerical value matters (i.e., must properly include NaNs, whatever) should be sent as an encoded base64 blob.
6. Properly support HEAD, PUT, PATCH, OPTIONS.
7. Send back your response as human-readable JSON, with newlines and tabs. If you can't afford the bandwidth (protip: you can), then you shouldn't be using a text format anyways.
8. Allow me to change replies using accept headers and extensions on the URI. Document the order of precedence.
9. Understand the limits of the REST mental model for handling things--don't be afraid to have a few "ugly" endpoints.