# Installation

## Quick Start with HTTL

### Install HTTL

Download the latest version of HTTL from the [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=HTTL.httl-vscode)

```
npm install httl-cli -g
```

### Create .httl file

Create a new file with a `.httl` extension.

### Write a query

**Basic**

**basic.httl**

```
get https://httpbin.org/anything
```

**Advanced**

**advanced.httl**

```
@base: https://reqres.in/api

# Getting a bearer token
post /login {
  email: "eve.holt@reqres.in",
  password: "cityslicka",
}
as auth # Save the json response body to the variable auth

# Set a global Authorization header which will be used in all requests below.
# Also we can use dot notation to access the properties of the response body.
Authorization: Bearer {auth.token}

# Create a new user
post /users {
  name: "rob",
  job: "engineer",
}
as new_user # save the response to the variable new_user

# Update the user
put /users/{new_user.id} {
  name: "Robert",
  job: "CEO",
}

# Delete the user
delete /users/{new_user.id}
assert {
  status: 204,
  headers: {
    "Content-Length": "0",
  }
}
```

### You are good to go! Run the query

Click the `Run` button to execute your query.

Alternatively, you can use the shortcut keys `Ctrl|Cmd + Enter`, or press `F5`.

```
httl get https://httl.dev/api/users
```

### For VS Code only

Additionally, you can use the `Quick Run` panel to execute your query.
The query text is saved in the current workspace, so you can run it again at any time.

---
