October 29, 2024 08:59 by
Peter
We can test our APIs with a new capability in Visual Studio 2022. If Swagger is not available, we can test and experiment with the API's endpoints using Endpoint Explorer from Visual Studio.
Procedures
As shown in the screen below, open any API project and select View->Other windows->Endpoint Explorer.
After opening Endpoint Explorer, we have the left window from where we can see all the listed API endpoints in applications.
Let’s Invoke
Right-click on the endpoint and click on Generate Request.
We will have the window below. We can click on the send request button and get a response.
We will get a response in the new window as below.
GET by ID. I have updated the ID as per the request URL and got the corresponding response.
Next Step
We can save this above middle window as a file with a .http extension and can use it next time without going to Endpoint Explorer. We can say this file is a ready-made rest client for playing and testing our endpoint.
I saved the above file and used the next file for testing purposes. Thanks