DEV Community

KenjiGoh
KenjiGoh

Posted on • Edited on

46 3 1

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

API Trace View

Struggling with slow API calls?

Dan Mindru walks through how he used Sentry's new Trace View feature to shave off 22.3 seconds from an API call.

Get a practical walkthrough of how to identify bottlenecks, split tasks into multiple parallel tasks, identify slow AI model calls, and more.

Read more →

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

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay