REST design summary

03. August 2014

It feels like this has been done so many times, it could replace your favorite “Hello World” code. But since I’m a sucker for summaries, here goes.

Read

Get a list of items. If successful, it responds with an array of IDs or objects.

Get a specific item. If successful, returns the object.

Create

If you want to create an new item (making sure it doesn’t exist):

If the item already exists:

Update

If you want to replace an existing item:

Update (change some fields)

If you want to update some fields of an existing item:

Delete

If you want to remove an existing item:

Other responses

Rarities

Final words

This will cover 80%+ of what you need in your daily REST work. Users will expect this behavior and will feel comfortable with it. It also helps design clean APIs.

If you want a longer + more comprehensive list, go here or here.

blog comments powered by Disqus