Skip to content

Instantly share code, notes, and snippets.

@phudgins
Created April 25, 2014 13:15
Show Gist options
  • Save phudgins/11289182 to your computer and use it in GitHub Desktop.
Save phudgins/11289182 to your computer and use it in GitHub Desktop.
Restful vs Non Restful communication

Non Restful

Client: Create a widget with a price of $2.00.

Server: OK.

Client: It worked! Great! Get me the widget I just created.

Server: OK.

Client: This isn't my widget. Get me a list of all the widgets.

Server: OK.

Client: My widget isn't in this list. I'll try again. Create a widget with a price of $2.00.

Server: OK.

Client: What is C2319? Where'd I put the API docs? Search for a widget that's $2.00.

Server: OK.

Client: This isn't even a widget! You suck!

Server: OK.

Restful

Client: Create a widget with a price of $2.00.

Server: Unauthorized.

Client: Oops, forgot my credentials. Create a widget with a price of $2.00. Here are my credentials.

Server: Created.

Client: That's a nice widget! Update the price of that widget to "forty two dollars".

Server: Unprocessable Entity.

Client: Oh yeah the price has to be a number.

Client: Make a cup of coffee with 2 sugars.

Server: I'm a teapot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment