>_ RESTERM
v1.18.2

examples Start here

basic.http

A file-wide base URL, GET and POST, a binary download, time and random data helpers, and bearer auth. Its resterm.env.json holds the environments that most files in this folder use.

runs as-is

shell
resterm run --all _examples/basic.http

Run this from the root of a clone of the Resterm repository.

Editor
// A setting placed before the first request applies to every request in the
// file, so the host is written once here instead of in each request line.
// A request may still override it, as the binary download below does.
# @setting base-url {{base.url}}

### Status Check
# @name getStatus
GET /status/204
User-Agent: resterm/0.1
Accept: application/json

### Download binary file
# @name downloadBinary
// GitHub returns 404 when an invalid Authorization header is sent. The example
// environment defines global auth, so disable it for this request.
// A request setting overrides the file default. A base URL can include a path.
// Keep the trailing slash when the path is a directory, otherwise the relative
// URL replaces its final segment.
# @auth none
# @setting base-url https://raw.githubusercontent.com/unkn0wn-root/resterm/main/
GET _media/resterm_base.png

### Create Post
# @name createPost
POST /anything/posts
Content-Type: application/json
Accept: application/json

{
  "title": "foo",
  "body": "bar",
  "userId": 1
}

### Timestamp Helpers
# @name timestampHelpers
POST /anything/time
Content-Type: application/json
Accept: application/json

{
  "now_unix": "{{$timestamp}}",
  "now_unix_plus_6d": "{{$timestamp + 6d}}",
  "now_iso_minus_90m": "{{$timestampISO8601 - 90m}}",
  "now_unix_ms": "{{$timestampMs}}"
}

### Random Data Helpers
# @name randomHelpers
POST /anything/signup
Content-Type: application/json
Accept: application/json

{
  "id": "{{$uuid}}",
  "name": "{{$randomName}}",
  "email": "{{$randomEmail}}",
  "employer": "{{$fake.company}}",
  "city": "{{$fake.city}}",
  "phone": "{{$fake.phone}}",
  "password": "{{$randomString(24)}}",
  "plan": "{{$randomChoice('free', 'pro', 'team')}}",
  "seats": "{{$randomInt(1, 25)}}"
}

### Bearer Auth Example
# @name bearerEcho
# @auth bearer {{auth.token}}
GET /bearer
Accept: application/json

_examples/basic.http on GitHub

Request file anatomy docs
Search

↑↓ moveEnter openEsc close

Help

These keys work like the ones in the TUI.

/
Search the docs (also Ctrl K)
j k
Scroll down and up
g g G
Jump to the top or the bottom
[ ]
Previous and next page
g d
Docs index
g h
Home page
t
Switch between dark and light
?
Show this help
Esc
Close a dialog