Input and Shorthand
Restish shorthand lets you create structured request bodies directly on the command line. JSON is the default request encoding, but the same body model can be encoded as YAML, form data, multipart, CBOR, and other registered types.
Object Input
The /post endpoint echoes the parsed body so you can confirm the result.
Nested Objects And Arrays
Use quotes when your shell would otherwise treat brackets or spaces specially:
Strings, Nulls, And Empty Values
Shorthand coerces common scalar values. Force strings with quotes when the exact text matters:
Stdin And Patches
Use stdin for larger payloads:
echo '{"name":"Alice","role":"user"}' | restish post api.rest.sh/post
When stdin is not structured JSON or YAML, Restish preserves it as a plain text
request body. -c text sends Content-Type: text/plain:
printf 'hello from stdin' | restish post -c text api.rest.sh/post
Add shorthand arguments to patch structured stdin before sending:
echo '{"name":"Alice","role":"user"}' | restish post api.rest.sh/post 'role: admin'
Form Bodies
Use -c form for URL-encoded request bodies:
Representative output:
{
"token": "docs-token-alice",
"token_type": "Bearer",
"user": "alice"
}
Multipart Uploads
Use -c multipart for form-style uploads. The example API echoes normal
fields and reports file metadata when the request contains real file parts:
printf 'hello from docs\n' > upload.txt
restish post -c multipart api.rest.sh/uploads 'description: docs, file: @upload.txt'
The response echoes multipart field values. When a client sends real file parts, /uploads also reports file metadata such as field name, filename, content type, and size. A multipart @path value must point to a readable file; use @@value when a text field should start with a literal @.
File Loading
restish post api.rest.sh/post 'payload: @payload.json'
restish post api.rest.sh/post 'note: @message.txt'
Structured files are parsed when possible. Quote or force string behavior when a
literal @ should be sent as text. In multipart bodies, use @@value for a
literal text value that starts with @, because @path is reserved for file
parts.
Generated Command Schemas
Generated OpenAPI commands use schemas for help, completions, examples, media selection, and bounded coercion. They do not reject explicit body fields just because the schema says a value has a different type, enum, or shape. Restish sends what you ask for and lets the server validate API-specific semantics.
Use --rsh-validate on a generated command when you want an optional local
JSON Schema check before sending a JSON request body. Validation happens after
Restish builds the body, and it does not rewrite or coerce values.
Restish still fails locally when the CLI cannot build a request, such as a
missing required path argument, unreadable @file, or invalid Restish flag.