Documenting and testing web services
You can easily test a web service by making HTTP GET requests using a browser. To test other HTTP methods, we need a more advanced tool.
Testing GET requests using a browser
You will use Chrome to test 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:
- Start the
Northwind.WebApiweb service. - Start Chrome.
- Navigate to
https://localhost:5001/api/customersand note the JSON document returned, containing all 91 customers in the Northwind database (unsorted), as shown in Figure 16.3:
Figure 16.3: Customers from the Northwind database as a JSON document
- Navigate to
https://localhost:5001/api/customers/?country=Germanyand note the JSON document returned, containing only the customers in Germany, as shown in Figure 16.4:
Figure 16.4: A list of customers from Germany as a JSON document...