Skip to content

cub api

cub api

Send a request to the ConfigHub API

Synopsis

Send a request to any ConfigHub API endpoint, with the active context's server and credentials, and print the response body.

The path is relative to the API root, with or without a leading /api, and may carry its own query string. Use it for an endpoint or a parameter no other command exposes, or to see exactly what the server returns.

The command exits non-zero when the response status is 400 or above, after printing the body, which carries the server's error.

cub api <method> <path> [flags]

Examples

  # What an upload would change, as the server reports it
  cub api POST upload --query dry_run=true --query include=Mutations --data request.json

  # A Space's Units
  cub api GET "space/$SPACE_ID/unit?select=Slug,UnitID"

  # A request body from stdin
  jq -n '{Slug: "demo"}' | cub api POST space --data -

Options

      --content-type string   Content-Type of the request body, sent when --data is given (default "application/json")
  -d, --data string           request body: a file, or - for stdin
  -h, --help                  help for api
  -q, --query stringArray     query parameter key=value (repeatable)

Options inherited from parent commands

      --context string   The context to use for this command
      --debug            Debug output

SEE ALSO

  • cub - ConfigHub CLI