Documenting and trying out web services
You can easily try out a web service by making HTTP GET
requests using a browser. To try out other HTTP methods, we need a more advanced tool. But let's start by trying out GET
requests using a browser.
Making GET requests using a browser
You will use Chrome to try out the three implementations of a GET
request—for all customers, for customers in a specified country, and for a single customer using their unique customer ID:
- In
Northwind.WebApi
, in theProperties
folder, inlaunchSettings.json
, for thehttps
profile, change thelaunchUrl
to request all customers, as shown highlighted in the following markup:
"launchUrl": "api/customers",
- Start the
Northwind.WebApi
web service project using thehttps
launch profile. Start Chrome, navigate to https://localhost:5091/api/customers, and note the JSON document returned, containing all 91 customers in the Northwind database (unsorted), as shown in Figure 9.2: