Basic Syntax
Basic Syntax
Section titled “Basic Syntax”Every .rext file contains one or more HTTP requests. This page covers the fundamental structure.
Request Structure
Section titled “Request Structure”A request follows this order:
[directives] → @name, @id, @collection, etc.METHOD URL → GET https://api.example.com/users[headers] → Content-Type: application/json → (empty line)[body] → { "key": "value" } → (empty line or @directive)[post-directives] → @assert, @captureDelimiters
Section titled “Delimiters”Requests are separated using one of three delimiters:
| Delimiter | Description |
|---|---|
### | Classic separator (can include text as comment) |
--- | Clean Markdown-style separator |
| Double empty line | Two consecutive empty lines implicitly separate requests |
Example
Section titled “Example”### Auth RequestsPOST https://api.example.com/auth/loginContent-Type: application/json
{ "email": "user@example.com", "password": "secret"}
---GET https://api.example.com/users
GET https://api.example.com/profileSupported Methods
Section titled “Supported Methods”Rext supports all standard HTTP methods:
GET · POST · PUT · PATCH · DELETE · HEAD · OPTIONS
GET https://api.example.com/users
POST https://api.example.com/usersContent-Type: application/json
{ "name": "John", "email": "john@example.com"}
DELETE https://api.example.com/users/123Headers
Section titled “Headers”Headers are defined as Key: Value pairs, one per line, immediately after the method line:
POST https://api.example.com/dataContent-Type: application/jsonAuthorization: Bearer {{token}}X-Custom-Header: my-value
{ "data": "payload"}Request Body
Section titled “Request Body”The body comes after an empty line following the headers. Rext supports any content type:
JSON Body
Section titled “JSON Body”POST https://api.example.com/usersContent-Type: application/json
{ "name": "John", "email": "john@example.com"}Form Data
Section titled “Form Data”POST https://api.example.com/loginContent-Type: application/x-www-form-urlencoded
username=john&password=secretRaw Text
Section titled “Raw Text”POST https://api.example.com/webhookContent-Type: text/plain
This is a raw text bodyComments
Section titled “Comments”Any text after ### on the same line is treated as a comment:
### This is a comment about auth requestsPOST https://api.example.com/auth/loginNext Steps
Section titled “Next Steps”- Learn about variables and dynamic values
- Explore metadata directives like
@nameand@id