Saturday, April 13, 2013

ASP.NET MVC Web API in contrast to REST

Here is my recreation of two slides from Ryan Vice's talk on Monday. First up is the convention for an RPC (Remote Procedure Call) RESTesque API:

ROUTE ACTION VERB ARGUMENTS
\AccountManager\GetAccounts Get all accounts GET none
\AccountManager\GetAccounts\:id Get account by ID GET query string
\AccountManager\AddAccount Add account POST header
\AccountManager\UpdateAccount Update account POST header
\AccountManager\DeleteAccount Delete account POST query string
\AccountManager\Deposit Deposit funds POST header
\AccountManager\Withdraw Withdraw funds POST header

 
 

The Resource Centric ASP.NET MVC Web API is like so in contrast to what is above:

ROUTE ACTION VERB ARGUMENTS
\Accounts Get all accounts GET none
\Accounts\:id Get account by ID GET query string
\Accounts Add account POST header
\Accounts\:id Update account PUT header
\Accounts\:id Delete account DELETE header
\Accounts\:id\Deposit Deposit funds POST header and query string
\Accounts\:id\Withdraw Withdraw funds POST header and query string

No comments:

Post a Comment