- JSON to receive and send data
- use nouns instead of verbs for endpoint paths
- use logical nesting for endpoints: '/articles/:articleId/comments'
- handle errors gracefully and return standard error codes. 400,401,403,404, 500, 502, 503.
- allow filtering, sorting and pagination.
filter with query params like name and age. and also page query param and return a group of entries by paging.
example.com/articles?sort=+author,-datepublished
where + means ascending and - means descending
- Maintain good security: SSL certify, add roles to enforce principle of least privilege.
- cache data to improve performance:
- version the API if we're making changes that may break the clients.
- consider using learning Hasura to automatically generate APIs (REST and GraphQL) from database schemas.