Parallel Works

pw api

Make an authenticated request to the ACTIVATE API

Synopsis

Make an authenticated HTTP request to the ACTIVATE API and print the response.

pw api is an escape hatch for endpoints the CLI doesn't wrap, for poking at new routes, or for scripting against the raw API. It uses your current context's credentials and platform host (honoring --context, --platform-host, and PW_API_KEY), so no manual auth is needed.

Endpoints resolve under the API base, so workflows and /api/workflows are equivalent. The method defaults to GET, or POST when a body is supplied. Pass parameters with -F/-f: for GET they become query-string parameters, otherwise a JSON request body.

Note: with -i/--include, response headers are shown for successful (2xx) responses; on an HTTP error the response body is still printed and the exit code is non-zero.

pw api <endpoint> [flags]

Examples

  pw api workflows
  
  # Filter the response with jq
  pw api -q '.[].name' workflows
  
  # Fetch all pages of a list endpoint
  pw api --paginate users
  
  # POST with a typed JSON body (method defaults to POST)
  pw api -X POST -F name=demo -F enabled=true -F count=3 some/route
  
  # Send a raw body from stdin
  echo '{"name":"demo"}' | pw api -X POST --input - some/route
  
  # Include response status and headers
  pw api -i workflows
  
  # Override or add a request header
  pw api -H "X-Custom: value" workflows

Options

  -F, --field stringArray       Add a typed parameter in key=value format (repeatable)
  -H, --header stringArray      Add a request header in 'Key: Value' format (repeatable)
  -h, --help                    help for api
  -i, --include                 Include the HTTP response status line and headers in the output
      --input string            File to read the request body from (use '-' for stdin)
  -q, --jq string               Filter the JSON response using a jq expression
  -X, --method string           HTTP method for the request (default "GET")
      --paginate                Make additional requests to fetch all pages of results
  -f, --raw-field stringArray   Add a string parameter in key=value format (repeatable)
      --silent                  Do not print the response body
  -v, --verbose                 Print the HTTP request and the response status and headers (to stderr)

Options inherited from parent commands

      --context string         The context to use. Overrides PW_CONTEXT environment variable and current context from config.
      --platform-host string   The Parallel Works ACTIVATE platform host to use. Will override any other platform host settings.

SEE ALSO

  • pw - The Parallel Works ACTIVATE CLI