Authors: @Jacqueline Osborn, @Timothy Ko, @Yousef Ahmed

Last Updated: 3/24/21

REST is a specification that Hack4Impact often uses (as opposed to something like GraphQL) to design APIs - in this doc, we'll go over some of our guidelines when creating REST APIs.

HTTP Request Methods

The difference between PUT and PATCH can be a little confusing on when to use what - I've found this guide to be helpful in explaining the difference.

Similarly, PUT and POST can be confusing in that they are both capable of creating a resource. The difference is, assuming we have a database and an object X, expected behavior would be if we PUT X 1000 times, we still have one X object in the database. If we POST X 1000 times, we have 1000 X objects.

REST URI Naming Conventions

Dos and Don'ts

Good: /users
Bad: /user
Bad: /getUsers
Good: /users/1 // Get user with id 1
Bad: /users?id=1