api post
HTTP POST with optional body, body file, or multipart form queue
Issue an HTTP POST. Optional JSON/text body inline or from a file beside the .stk. With a pending form queue (fields/files), a bare path sends multipart/form-data.
Syntax
When I api post "<path>"
When I api post "<path>" with body '<json-or-text>'
When I api post "<path>" with body file "<filename>"Prefer single quotes around JSON bodies so inner " do not need escaping.
Qualifiers
| Qualifier | Role | Example |
|---|---|---|
with body | Inline request body | with body '{"item":"book"}' |
with body file | Body from file beside .stk (or files/) | with body file "create-order.json" |
Examples
When I api post "/orders" with body '{"item":"book"}'
When I api post "/orders" with body file "create-order.json"Multipart (prepare then send):
When I api set fields to '{"name":"Invoice"}'
When I api set file "main" to "invoice.pdf"
When I api post "/upload"Notes
- If the form queue is non-empty, bare
api postsends multipart and clears the queue. - Do not combine a pending form queue with
with body/with body file. with body fileis raw file bytes as the request body (usually JSON text) — not multipart upload. Use api set file for files.
Related
- api get
- api put
- api patch
- api delete
- api set field / api set fields / api set file
- upload (same beside-
.stkfile lookup)