docs: rewrite JsonRpcBundle docs, add SDK docs, move them under docs/api
en/docs/api/rest-bundle/config.md
new file +54
ā0
1
+
# Configuration
2
+
3
+
The bundle has no configuration tree of its own: REST entry points are defined by routes files, and everything else comes from the JsonRpcBundle settings `ufo_json_rpc` ([Bundle configuration](/docs/api/json-rpc-bundle/config)).
4
+
5
+
## Routes
6
+
7
+
Each REST entry point is a separate import of the bundle's `config/router.yaml`:
8
+
9
+
```yaml
10
+
# config/routes/ufo_rest_api.yaml
11
+
ufo_rest_api:
12
+
resource: ../../vendor/ufo-tech/rest-bundle/config/router.yaml
13
+
prefix: /rest
14
+
trailing_slash_on_root: false
15
+
```
16
+
17
+
| Import key | What it sets |
18
+
| --- | --- |
19
+
| `prefix` | The entry point address; documentation is at the prefix itself, methods are under it |
20
+
| `defaults: { api_group: <group> }` | The [API group](/docs/api/json-rpc-bundle/functionality/groups) of the entry point; without it, `general` |
21
+
| `name_prefix` | An extra route name prefix when one group is imported twice |
22
+
| `trailing_slash_on_root` | `false`, so that documentation answers at `/rest`, not `/rest/` |
23
+
24
+
Details are in [Routing](/docs/api/rest-bundle/routing).
25
+
26
+
## What is used from `ufo_json_rpc`
27
+
28
+
| Parameter | Purpose in REST |
29
+
| --- | --- |
30
+
| `security.protected_api` | Check the token for REST calls |
31
+
| `security.protected_doc` | Check the token for OpenAPI and Postman |
32
+
| `security.token_name` | Name of the token header |
33
+
| `security.clients_tokens`, `security.providers` | Valid tokens, separately for API groups |
34
+
| `docs.project_name`, `docs.project_description` | `info.title` and `info.description` in OpenAPI, the Postman collection name |
35
+
| `translations.paths` | Extra directories with translations of method titles and descriptions (since 1.3) |
36
+
37
+
```yaml
38
+
# config/packages/ufo_json_rpc.yaml
39
+
ufo_json_rpc:
40
+
security:
41
+
protected_api: true
42
+
protected_doc: false
43
+
token_name: 'Ufo-RPC-Token'
44
+
clients_tokens:
45
+
- '%env(resolve:UFO_API_TOKEN)%'
46
+
47
+
docs:
48
+
project_name: 'My Project'
49
+
project_description: 'Public API'
50
+
```
51
+
52
+
Changes to these parameters apply equally to JSON-RPC and REST. REST cannot be configured separately, for example to open the REST documentation while keeping the RPC one closed.
53
+
54
+
How tokens work for REST is described on the [Security](/docs/api/rest-bundle/security) page.