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:
- In Terminal, start the
NorthwindService
Web API web service by entering the following command:dotnet run
- In Chrome, navigate to
https://localhost:5001/api/customers
and note the JSON document returned, containing all the 91 customers in the Northwind database, as shown in the following screenshot: - Navigate to
https://localhost:5001/api/customers/?country=Germany
and note the JSON document returned, containing only the customers in Germany, as shown in the following screenshot:If you get an empty array returned, then make sure you have entered the country name using the...