Skip to main content

Overview ›Get Started

Auf GitHub bearbeiten

Diese Dokumentation ist auf Englisch verfügbar.

Get Started

This page takes you from installing DotFetch to sending a request that uses a variable from your .env file.

1. Install

In VS Code, open the Extensions view (Ctrl+Shift+X, or Cmd+Shift+X on macOS), search for DotFetch, and click Install.

Or press Ctrl+P and run:

ext install FreeRave.dotfetch

After installing, a DotFetch icon appears in the Activity Bar. It opens a sidebar with four sections:

SectionWhat it holds
Quick ActionsNew Request, Import cURL, and your Favorites
CollectionsRequests you saved, grouped into collections
HistoryEvery request you sent, newest first
EnvironmentsYour .env files and the variables inside them

2. Send your first request

  1. Click New Request in Quick Actions. The Request Builder opens as an editor tab.
  2. Leave the method on GET and type this URL: https://httpbin.org/get?hello=world
  3. Press Send, or Ctrl+Enter (Cmd+Enter on macOS).

The response appears at the bottom:

JSON
{
  "args": { "hello": "world" },
  "headers": { "Host": "httpbin.org", "...": "..." },
  "url": "https://httpbin.org/get?hello=world"
}

Next to the word Response you see the status (200 OK), the time it took (312 ms), and the size (0.4 KB). The request is also added to History: a yellow spinner while it is sending, then a green icon for success or a red one for an error.

3. Send a POST with a JSON body

  1. Change the method to POST and the URL to https://httpbin.org/post.
  2. Open the Body tab and paste:
    JSON
    { "name": "Ada", "role": "admin" }
  3. Press Send.

You don't need to add a Content-Type header. When the body is valid JSON and you haven't set one, DotFetch sends Content-Type: application/json for you. httpbin echoes your body back under "json".

4. Use a variable from .env

Hard-coding IDs and tokens into URLs gets old fast. Put them in a .env file at the root of your workspace instead:

BASH
# .env
BASE_URL=https://httpbin.org
USER_ID=42
  1. In the Environments section, default (the name DotFetch gives .env) now appears. Hover it and click the Set as Active Environment button, or right-click it and choose the same command.
  2. Use the variables with double curly braces: GET {{BASE_URL}}/anything/users/{{USER_ID}}
  3. Press Send. httpbin shows the real URL that was sent:
    JSON
    "url": "https://httpbin.org/anything/users/42"

The Request Builder keeps {{USER_ID}} exactly as you typed it, and History shows it that way too. The value is only filled in at the moment the request is sent. Read Environments for multiple environments (dev, staging, production) and how values are resolved.

5. Save it

Press Ctrl+Alt+S (Cmd+Alt+S on macOS) or click 💾 Save, give the request a name, and choose a collection. It now appears under Collections, and one click loads it back. See Collections, Favorites & History.

Keyboard shortcuts

These work while the Request Builder tab is focused:

ShortcutAction
Ctrl+Enter / Cmd+EnterSend the request (press again while it's running to cancel)
Alt+DFocus and select the URL bar
Ctrl+Alt+S / Cmd+Alt+SSave to a collection
Ctrl+Shift+Backspace / Cmd+Shift+BackspaceClear the form
?Show or hide the shortcuts help
EscapeClose the open dialog

Settings

Open Settings and search for dotfetch:

SettingDefaultWhat it does
dotfetch.timeout10000Default timeout in milliseconds (1000–300000)
dotfetch.retryCount0Default number of retries when the server can't be reached (0–5)
dotfetch.sslVerifytrueVerify TLS certificates by default
dotfetch.maxHistory50How many requests History keeps. Older entries are dropped.

The first three are defaults: a new request starts with them in its ⚙️ tab, and you can change them there for that one request. See Request settings.

Next steps

Get Started · DotFetch Docs | dotsuite