Console calls

← Console calls

Ashterix

docs: rewrite JsonRpcBundle docs, add SDK docs, move them under docs/api

en/docs/api/json-rpc-bundle/functionality/cli.md new file +29 −0

1 + # Console calls
2 +
3 + The `ufo:rpc:process` command executes an RPC request without HTTP: handy for cron, scripts and debugging. Single and batch requests are supported, and token verification is the same as for HTTP.
4 +
5 + ```bash
6 + php bin/console ufo:rpc:process '{"jsonrpc": "2.0", "id": 1, "method": "ping"}' --ufo-rpc-token=<token>
7 + ```
8 +
9 + ## Arguments and options
10 +
11 + | Argument / option | Description |
12 + | --- | --- |
13 + | `json` | Request JSON; `-` reads from stdin; `@env` reads from the `UFO_RPC_REQUEST` variable |
14 + | `--<token_name>` | Token. The option name is `security.token_name` in lowercase (`Ufo-RPC-Token` → `--ufo-rpc-token`); required when `protected_api: true` |
15 + | `--api-group` | [API group](/docs/api/json-rpc-bundle/functionality/groups), `general` by default |
16 + | `--ver` | [API version](/docs/api/json-rpc-bundle/functionality/versions), `v1` by default |
17 +
18 + If the token option is not passed, the token is taken from the `UFO_RPC_TOKEN` environment variable.
19 +
20 + :::tip subtitle="Do not expose the token and data"
21 + Command-line arguments are visible in the process list. Pass the request via stdin and the token via an environment variable:
22 +
23 + ```bash
24 + echo '{"jsonrpc":"2.0","id":1,"method":"Report.build","params":{"month":"2026-09"}}' \
25 + | UFO_RPC_TOKEN=<token> php bin/console ufo:rpc:process - --api-group=internal
26 + ```
27 + :::
28 +
29 + The response is printed to stdout in JSON-RPC format. The bundle uses the same command for [batch](/docs/api/json-rpc-bundle/functionality/batch) child processes and detached [notifications](/docs/api/json-rpc-bundle/functionality/notifications).