Exercise: Consuming a RESTful service

There is a simple RESTful service running on http://anbo-restserviceproviderbooks.azurewebsites.net/Service1.svc/books/

Example URIs

GET (read information)

POST (add information)

PUT (update information)

DELETE (delete information)

Use a browser

With a browser you can easily use the HTTP method/verb GET on the URIs.

Use WireShark to object the requests and responses.

Use Postman

Postman is an application for Google Chrome. With Postman you can use all the HTTP methods/verbs: GET, PUT, PUT, DELETE, etc.

  1. Make sure you have Google Chrome
  2. Download Postman from the Chrome web store.
    Postman documentation
  3. Use Postman to send GET, POST, PUT and DELETE requests to the service (the service might not support all the HTTP methods/verbs)
    Please, do not destroy the data.
    Only update and delete data that you created.
    Clean up the objects you added.

Use WireShark to object the requests and responses.

Make your own client application

In Visual Studio create a simple Console Application.

The application should

  1. send request to the Book service.
  2. read the response
  3. if the response includes data, then create one or more objects from this data

Sending request and reading response can be done using the class HttpClient.
Maybe you want to add some extension method PutAsJsonAsync and PostAsJsonAsync: Nuget System.Net.Http.Formatting

Making objects can be done using JSON or XML de-serialization, see the plan. Nuget NewtonSoft.Json.
You will probably have to make a model/transport class Book with properties that match the properties of the Book service.

Use WireShark to observe the requests and responses.