Skip to main content
The yasumu rest command provides subcommands for executing REST API requests and managing REST entities in your workspace.

Subcommands

  • yasumu rest run - Execute REST entities
  • yasumu rest list - List all REST entities

run

Execute one or more REST entities from your workspace.

Usage

yasumu rest run [target] [options]

Arguments

target
string
The name or ID of the REST entity to execute. Required unless --all is specified.

Options

-p, --path
string
Path to the workspace directory. Defaults to the current directory.
-a, --all
boolean
Run all REST entities in the workspace sequentially.
--no-script
boolean
Skip execution of pre-request and post-request scripts.
-e, --env
string
Environment name or ID to use for variable resolution. If not specified, no environment variables are used.
-v, --verbose
boolean
Show detailed response information including headers and full response body.
--json
boolean
Output results as JSON instead of formatted text.

Examples

Run a single entity by name

Execute a specific REST entity:
yasumu rest run "Login API"
Output:
Running 1 REST entity...

✓ GET Login API
  Status: 200 OK
  Duration: 245ms
  URL: https://api.example.com/auth/login

Summary: 1 passed

Run with environment variables

Execute an entity using a specific environment:
yasumu rest run "Create User" --env production
Output:
Running 1 REST entity...
Using environment: production

✓ POST Create User
  Status: 201 Created
  Duration: 312ms
  URL: https://api.example.com/users

Summary: 1 passed

Run all entities

Execute all REST entities in the workspace:
yasumu rest run --all
Output:
Running 15 REST entities...

✓ GET Login API
  Status: 200 OK
  Duration: 245ms

✓ POST Create User
  Status: 201 Created
  Duration: 312ms

✓ GET List Users
  Status: 200 OK
  Duration: 189ms

...

Summary: 15 passed

Run with verbose output

Show detailed response information:
yasumu rest run "Login API" --verbose

Skip scripts

Run without executing pre-request and post-request scripts:
yasumu rest run "Login API" --no-script
Output:
Running 1 REST entity...
Scripts: disabled

✓ GET Login API
  Status: 200 OK
  Duration: 245ms

Summary: 1 passed

JSON output for CI/CD

Get structured JSON output for parsing:
yasumu rest run --all --json
Output:
{
  "summary": {
    "total": 3,
    "success": 2,
    "failed": 1
  },
  "results": [
    {
      "id": "entity-123",
      "name": "Login API",
      "method": "GET",
      "url": "https://api.example.com/auth/login",
      "success": true,
      "status": 200,
      "statusText": "OK",
      "duration": 245,
      "headers": {
        "content-type": "application/json",
        "content-length": "1234"
      },
      "body": {
        "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
      }
    },
    {
      "id": "entity-456",
      "name": "Create User",
      "method": "POST",
      "url": "https://api.example.com/users",
      "success": true,
      "status": 201,
      "statusText": "Created",
      "duration": 312,
      "headers": {
        "content-type": "application/json"
      },
      "body": {
        "id": "user-789",
        "name": "John Doe"
      }
    },
    {
      "id": "entity-789",
      "name": "Invalid Endpoint",
      "method": "GET",
      "url": "https://api.example.com/invalid",
      "success": false,
      "status": 404,
      "statusText": "Not Found",
      "duration": 123,
      "error": "Resource not found"
    }
  ]
}

Error handling

If the specified entity is not found:
yasumu rest run "Nonexistent API"
Output:
REST entity not found: Nonexistent API

Available entities:
  - Login API (entity-123)
  - Create User (entity-456)
  - List Users (entity-789)
If no target is specified and --all is not used:
yasumu rest run
Output:
Please specify an entity name/id or use --all to run all
If an environment is not found:
yasumu rest run "Login API" --env nonexistent
Output:
Environment not found: nonexistent

Available environments:
  - Development (env-001)
  - Staging (env-002)
  - Production (env-003)

Exit codes

  • 0 - All requests succeeded
  • 1 - One or more requests failed or an error occurred

list

List all REST entities in the workspace.

Usage

yasumu rest list [options]

Options

-p, --path
string
Path to the workspace directory. Defaults to the current directory.
--json
boolean
Output the list as JSON instead of formatted text.

Examples

List all entities

Display all REST entities in formatted text:
yasumu rest list
Output:
REST Entities (3):

  GET    Login API (<script/>)
         https://api.example.com/auth/login
         ID: entity-123

  POST   Create User (<script/>, <test/>)
         https://api.example.com/users
         ID: entity-456

  GET    List Users
         https://api.example.com/users
         ID: entity-789
Entities with pre-request/post-request scripts show a <script/> tag. Entities with test scripts show a <test/> tag.

JSON output

Get the entity list as JSON:
yasumu rest list --json
Output:
[
  {
    "id": "entity-123",
    "name": "Login API",
    "method": "GET",
    "url": "https://api.example.com/auth/login",
    "hasScript": true,
    "hasTest": false,
    "groupId": "group-001"
  },
  {
    "id": "entity-456",
    "name": "Create User",
    "method": "POST",
    "url": "https://api.example.com/users",
    "hasScript": true,
    "hasTest": true,
    "groupId": "group-001"
  },
  {
    "id": "entity-789",
    "name": "List Users",
    "method": "GET",
    "url": "https://api.example.com/users",
    "hasScript": false,
    "hasTest": false,
    "groupId": "group-002"
  }
]

Output format

Text output

The formatted text output includes:
  • HTTP method (color-coded)
  • Entity name
  • Script/test indicators
  • URL
  • Entity ID
HTTP method colors:
  • GET: Green
  • POST: Blue
  • PUT: Magenta
  • PATCH: Yellow
  • DELETE: Red
  • OPTIONS: Magenta
  • HEAD: Gray

JSON output

The JSON output includes:
  • id - Unique entity identifier
  • name - Entity name
  • method - HTTP method
  • url - Request URL
  • hasScript - Whether the entity has pre/post-request scripts
  • hasTest - Whether the entity has test scripts
  • groupId - ID of the group containing this entity

Empty workspace

If no REST entities exist:
yasumu rest list
Output:
No REST entities found

Build docs developers (and LLMs) love