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

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn 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

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Explore a sea of insights with this enlightening post, highly esteemed within the nurturing DEV Community. Coders of all stripes are invited to participate and contribute to our shared knowledge.

Expressing gratitude with a simple "thank you" can make a big impact. Leave your thanks in the comments!

On DEV, exchanging ideas smooths our way and strengthens our community bonds. Found this useful? A quick note of thanks to the author can mean a lot.

Okay