API Days

I’m working on my first .NET Web API service – and so far , so good! There are some great introductory videos at www.asp.net/web-api, but as far as I can tell it’s simply a case of firing up the Visual Studio template and implementing methods for the 4 main HTTP verbs: Get, Post, Put, Delete. These verbs correspond to CRUD like so:
  • Get = Read
  • Post = Create
  • Put = Update
  • Delete = Delete (duh)

You can control and shape the response sent back to the client – so that, for instance, following a successful POST you can return an HTTP status of: 201 (Created), plus optionally the location of the new resource.

And that’s pretty much it! Though as usual with Microsoft there is more that you can do – you can tweak Routing (it is based on MVC after all), you can implement your own MediaTypeFormatters and you can explore OData.

Sometimes .NET can feel very abstracted, very high level – but this is very stripped down and close to the wire. Using Fiddler you can see exactly what is being sent – and how small those messages are!

Comments