Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Building Web Services with Windows Azure (new)

You're reading from   Building Web Services with Windows Azure (new) Quickly develop scalable, REST-based applications or services and learn how to manage them using Microsoft Azure

Arrow left icon
Product type Paperback
Published in May 2015
Publisher
ISBN-13 9781784398378
Length 322 pages
Edition 1st Edition
Languages
Arrow right icon
Toc

Table of Contents (12) Chapters Close

Preface Introduction FREE CHAPTER 1. Getting Started with the ASP.NET Web API 2. Extending the ASP.NET Web API 3. API Management 4. Developing a Web API for Mobile Apps 5. Connecting Applications with Microsoft Azure Service Bus 6. Creating Hybrid Services 7. Data Services in the Cloud – an Overview of ADO.NET and Entity Framework 8. Data Services in the Cloud – Microsoft Azure Storage 9. Data Services in the Cloud – NoSQL in Microsoft Azure Index

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 port will be allocated by IIS Express and will be different for each installation.

  3. This yields a result similar to the following in the browser:
    {
        "Id": 1,
        "AccountNumber": "43a2a3eb-e0b8-4840-9e5e-192214a79d58...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime