Requests
Every .yml file is a request, except opencollection.yml, folder.yml, and anything under environments/ or critters/.
Example
Section titled “Example”info: name: Create user type: http seq: 2 # order in its folder tags: [admin]http: method: POST url: "{{baseUrl}}/users" headers: - name: Idempotency-Key value: "{{requestId}}" body: type: json data: |- { "email": "{{email}}", "role": "member" } auth: inheritruntime: assertions: - expression: res.status operator: eq value: "201" actions: - type: set-variable phase: after-response selector: expression: res.body.id method: jsonq variable: name: userId scope: runtimesettings: timeout: 10000 # ms; default 30000docs: Creates a member and saves its id as {{userId}}.Only info and http are required.
Folders
Section titled “Folders”A folder is a directory. An optional folder.yml sets its name, its order, and defaults for the requests inside it:
info: name: Admin type: folder seq: 3request: headers: - name: X-Admin value: "true" auth: type: bearer token: "{{adminToken}}"At each level, folders and requests are sorted together by seq. cactus-cli run sends them in that order.
Params
Section titled “Params”params mirrors the URL’s query string. Edit either one and cactus updates the other.
http: url: "{{baseUrl}}/users/:id?expand=orders" params: - name: id value: "{{userId}}" type: path - name: expand value: orders type: querydisabled: true keeps a param or header in the file without sending it.
Headers
Section titled “Headers”Headers come from the collection, then each enclosing folder, then the request itself. A header set later replaces an earlier one with the same name.
Bodies
Section titled “Bodies”type |
data |
|---|---|
json |
JSON text |
text, xml, sparql |
Text |
form-urlencoded |
name/value list |
multipart-form |
List of text or file parts |
file |
A project file sent as the body |
body: type: form-urlencoded data: - name: grant_type value: passwordbody: type: multipart-form data: - name: title type: text value: Report - name: file type: file value: - fixtures/report.pdfbody: type: file data: - filePath: fixtures/avatar.png contentType: image/png selected: trueFile paths are relative to the project and can’t point outside it.
Variables are inserted as text. Quote a value that should be a string; leave quotes off one that should be a number: "count": {{count}}.
Sending
Section titled “Sending”| Keys | |
|---|---|
| Ctrl+Enter | Send, including unsaved edits |
| Ctrl+S | Save |
| Ctrl+P | Jump to a request |
| Ctrl+D | Duplicate |
A variable with no value is sent as written ({{name}}) and listed as unresolved next to the response.
Past responses are kept per request in .cactus/history/.
Outside edits
Section titled “Outside edits”If a file changes on disk while you have unsaved edits to it, cactus asks whether to reload it or keep yours. A file that doesn’t parse is never overwritten.