O'Reilly logo

Building Web Services with Microsoft Azure by Nikhil Sachdeva, Stephen Kaufman, Alex Belotserkovskiy

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Testing the Web API

Now that we have a Web API created, we will look at options to validate our Web API functionality. Testing is a crucial stage in the creation of Web API development and publishing. There are a couple of different ways of doing this. We can just test it by requesting the URL in a browser or write code and leverage the System.Net.HttpClient type. This section discusses both of these approaches.

Testing in a browser

Testing a Web API is as simple as developing it, since each action in a Web API controller represents a resource, we can just type the URL of the resource and fetch the results.

  1. Press F5 in Visual Studio to launch the Web API in a browser.
  2. Visit the following URL:

    http://localhost:<PORT>/api/package/1

    Note

    Note that the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required