Categories
API

REST APIs: some guidelines on constructing them

Don’t use verbs as part of the URL to express your actions:

/users/johndoe/create

Make use of the HTTP protocols instead:

GET: get

POST: create

PUT: Update

DELETE: (You guess..)

So in this case, you can use /users/johndoe/ and POST to create, etc

Use the status codes returned by the server to signal success / failure / not found / etc. Avoid the temptation to include status on your return some other way…