DEV Community

KenjiGoh
KenjiGoh

Posted on • Updated on

Using Curl on VS Code

Making GET Requests with Curl

Curl, short for Client for URLs, is a command line tool that allows us to transfer data to and from a server. It is free and open-sourced. It supports multiple protocols, including HTTP. Find out more at curl documentation or their source code

Why use Curl?

Curl provides an easy way to make requests to a server from the command line or from inside a script. It is especially helpful for testing APIs while building applications because making a request with curl allows you to hit endpoints for which the corresponding user interfaces do not yet exist.

We can easily use curl on any CLI.



curl http://www.google.com


Enter fullscreen mode Exit fullscreen mode

Or we can install extensions for better visualization:

Steps:

1. Install REST Client

Image description

2. Create/Open a new File

Image description

3. Ctrl+Shift+P and Change Language Mode to HTTP

Image description

4. Type in curl commands and start requesting!



curl --request GET www.google.com


Enter fullscreen mode Exit fullscreen mode

Image description

5. Other Alternatives

Top comments (1)

Collapse
 
jonasbn profile image
Jonas Brømsø

Thanks for the article. A brief follow up:

You can save the newly created files with the extension .http (I believe this is suggested), then you can configure your OS to associate *.http files with Visual Studio Code and then you have nifty little curl snippets at your disposal from your file system