Built in REST CLIENT (.http/.rest) file in Visual Studio 2022 | Best way to test the API

preview_player
Показать описание
Visual Studio 2022 has a built-in REST Client to test the API or Microservices. This can be done easily by adding a new file with the .http/.rest extension.
The .rest/.http is a special file in visual studio 2022 v17.5 and has a preview window also.
We can test multiple APIs from a single http/rest file. After using this .http/.rest file there would not be any need of using Postman, swagger, or any other external tool.
This is also called as API development inner-loop.

Chapters:

00:00 Introduction to built-in rest tool in visual studio 2022
00:41 Setting up the sample application.
01:51 Setup the .rest/.http file in visual studio
03:17 Test and debug the HTTP GET API using .http file in visual studio
06:06 Pass the data in the URL using .http/.rest file
07:37 Test and debug the HTTP POST API using .http file
08:19 Pass the headers in the HTTP call using .http file
11:15 Pass Authorization header in the HTTP call
11:22 Test the HTTP PUT API using .http file
12:37 Add comments in .http file
13:45 Variables in .http/.rest file

#visualstudio2022 #BuiltInRestClientInVisualStudio #nitishkaushik
Рекомендации по теме
Комментарии
Автор

*Not currently supported in the Visual Studio HTTP Editor*

Optional HTTP Method
Request line that spans more than one line
Named Requests
Dynamic variables
Environment files
Specify file path as body of the request
Mixed format for body when using multipart/form-data
GraphQL requests
cURL request
Copy/paste as cURL
Request history
Save response body to file
Certificate based authentication
Prompt variables
System variables
Customize response preview
Per-request settings

nitish.kaushik
Автор

It is nice to see that Visual Studio is adding new capabilities to easily test API endpoints. I use RESTful endpoints in many of my applications and it certainly is encouraging that Microsoft is building API testing capabilities into the IDE experience. This is a start, and I am sure that Microsoft will eventually get on par with Swagger and Postman.

michaelrockwell
Автор

Is there a nice way to handle the call an authentication route with a username/password and store the given token ?

thomasleberre
Автор

Terrific content and presentation! Let me add a couple of suggestions to make your videos perfect. Watching you type is distracting because my eye is trying to focus on the code and listening to your explanation. I would recommend that you skip showing yourself over the video. Second, please remember to talk slowly. Thank you for ccovering this new feature comprehensively.

MarkInChicago
Автор

Nice! Next they need to provide a way to also verify expected results, besides unit tests.

dianajdanj
Автор

Great stuff dude, i noticed a similar feature in Rider and hoped it would get ported to VS and now it is!

LlamaNL
Автор

Hi Kaushik. Your tutorial is very very helpful. Thank you for sharing your knowledge!!

kaushikbhadani-ttbm
Автор

Very nice feature of VS2022.Thanks for the new feature updates

akhilendushukla
Автор

Great - thanks! Having trouble adding an x-api-key to the header for for authentication - how would this be done?

rogerswetnam
Автор

Terrific overview, and I will start using this immediately. Question: What are the differences between using ".http" vs ".rest"? Are they identical, or is there a benefit to using one over the other?

the_quantum_nexus
Автор

Thank you for being aware it never knew before

siddharthazedia
Автор

Hello thanks for great content!, does it has enviroment variables feature ?, where i can find documentation?

juancarloshb
Автор

Can you do assertations in this expected to what is produced?

dotnetdevni
Автор

Excellently explained, thanks Nitish, subscribing to your channel

coding-gemini
Автор

Its a nice video. Is there any automation testing for the http file you have created. Instead of running each link. Can we automate it for testing

VijayKumar-jcnd
Автор

Great video. Thank you. Do you know if there is a way to change the timeout?

johnwarner
Автор

Is there a api test runner comming soon that would be awsome.

dotnetdevni
Автор

this seems okeish, for very simple stuff, how would you test authentication?, how would that work with nswag ? and also lets not forget frontend end devs .lets say you have frontend devs who need the api documentation thats swagger, to build by hand or with automation the services to API what would you provide to them ? i think in terms of development that helps only the backend dev.

TheCMajorth
Автор

Is there a way to pass response data from one call to a second call. this can be done in vscode version example: Authorization: }}

ronmodic
Автор

If you want to replace postman, the "Thunder client" extension is a great open-source option.

EDA.architect
welcome to shbcf.ru