When you're building your API, you should avoid falling into the following traps:
Patterns to Avoid
These are patterns that you should avoid.
Avoid Non-JSON Requests/Responses
Your API should only accept JSON requests and only respond with JSON responses. Do not utilize multi-part form data or other methods.
Avoid Inconsistent JSON Requests/Responses
You JSON should always look the same every single time.
Avoid URL Path Parameters and URL Query Parameters
URL and Query parameters are brittle and subject to inconsistent encoding schemes. You should avoid them. Only receive data from the JSON body and only respond through the JSON response. The only time it is acceptable the single "id" path parameter with the UPDATE and DELETE operations.
Avoid Case-Sensitive JSON
When possible, your JSON should be case in-sensitive. For example, setting firstname, firstName, or FirstName should all be valid.
Avoid Linking Items by Name
APIs are designed for computers to use, not people. Whenever an object is related to another object, always return IDs and not names.
For example, with a person, do not return company_name, instead, return company_id. On matters, don't return practicearea_name, but instead return practicearea_id.
Avoid Geo-Centric Dates
Your API should avoid dates such as "2022-02-25 10:59:31". A date like this does not contain a timezone which is ambiguous: it is in the user's time zone, the server's timezone, GMT, or some other timezone? Instead, use ISO8601 DateTimeOffsets. For example: 2017-04-19T11:18:51-07:00