Skip to content

Commit

Permalink
[docs]: update configuration endpoints
Browse files Browse the repository at this point in the history
Signed-off-by: Dmitry Balashov <[email protected]>
  • Loading branch information
0x009922 committed Nov 23, 2023
1 parent c01f77d commit 31d3494
Showing 1 changed file with 47 additions and 78 deletions.
125 changes: 47 additions & 78 deletions src/reference/torii-endpoints.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,47 @@ Via this endpoint, the client first provides the starting block number (i.e. hei
sending the confirmation message, the server starts streaming all the blocks from the given block number up to the
current block and continues to stream blocks as they are added to the blockchain.

## Configuration > Retrieve

- **Protocol:** HTTP
- **Method:** `GET`
- **Endpoint:** `/configuration`
- **Responses:** with JSON-serialized subset of configuration parameters. The subset of returned parameters is equal to
the one accepted by [Configuration > Update endpoint](#configuration-update), i.e. it contains only
`logger.max_log_level` parameter as of now.

Example response:

```json
{
"logger": {
"max_log_level": "TRACE"
}
}
```

## Configuration > Update

- **Protocol:** HTTP
- **Method:** `POST`
- **Endpoint:** `/configuration`
- **Expects:** a JSON-serialized subset of configuration parameters.

This endpoint currently supports only dynamic updating of the `logger.max_log_level` parameter.

For possible values please refer to the configuration reference (TODO:
[Tracking issue for configuration reference](https://github.com/hyperledger/iroha-2-docs/issues/392)).

Example request:

```json
{
"logger": {
"max_log_level": "DEBUG"
}
}
```

## Events

- **Protocol:** HTTP
Expand Down Expand Up @@ -140,12 +181,13 @@ Learn [how to use metrics](/guide/advanced/metrics).
results.
- **`sort_by_metadata_key`:** An optional parameter in queries. Use to sort results containing metadata with a given
key.
- **`fetch_size`:** An optional parameter in queries. Use to specify the exact number of results returned by a query.
- **`fetch_size`:** An optional parameter in queries. Use to specify the exact number of results returned by a
query.

**Responses:**

| Response | Status | Body |
| ---------------- | ------ | ------------------------------------------------------------------------------------------ |
| Response | Status | Body |
| ---------------- | ------ | ------------------------------------------------------------------------------------------------ |
| Success | 200 | [`VersionedBatchedResponse<Value>`](/reference/data-model-schema#versionedbatchedresponse-value) |
| Conversion Error | 400 | [`QueryExecutionFail::Conversion(String)`](/reference/data-model-schema#queryexecutionfail) |
| Evaluate Error | 400 | [`QueryExecutionFail::Evaluate(String)`](/reference/data-model-schema#queryexecutionfail) |
Expand All @@ -158,7 +200,7 @@ Learn [how to use metrics](/guide/advanced/metrics).
Whether each prerequisite object was found and [`FindError`](/reference/data-model-schema#finderror):

| Domain | Account | [`FindError`](/reference/data-model-schema#finderror) |
| :----: | :-----: | ------------------------------------------------------------------- |
| :----: | :-----: | ------------------------------------------------------------------------- |
| N | - | [`FindError::Domain(DomainId)`](/reference/data-model-schema#finderror) |
| Y | N | [`FindError::Account(AccountId)`](/reference/data-model-schema#finderror) |

Expand All @@ -167,7 +209,7 @@ Whether each prerequisite object was found and [`FindError`](/reference/data-mod
Whether each prerequisite object was found and [`FindError`](/reference/data-model-schema#finderror):

| Domain | Account | Asset Definition | Asset | [`FindError`](/reference/data-model-schema#finderror) |
| :----: | :-----: | :--------------: | :---: | ----------------------------------------------------------------------------------- |
| :----: | :-----: | :--------------: | :---: | ----------------------------------------------------------------------------------------- |
| N | - | - | - | [`FindError::Domain(DomainId)`](/reference/data-model-schema#finderror) |
| Y | N | - | - | [`FindError::Account(AccountId)`](/reference/data-model-schema#finderror) |
| Y | - | N | - | [`FindError::AssetDefinition(AssetDefinitionId)`](/reference/data-model-schema#finderror) |
Expand Down Expand Up @@ -209,7 +251,6 @@ struct Uptime {
}
```


::: warning JSON Precision Lost

Almost all fields in the `Status` structure are 64-bit integers, and they are encoded in JSON as-is. Since native JSON's
Expand Down Expand Up @@ -299,75 +340,3 @@ returns the corresponding JSON value.
[GitHub repository](https://github.com/paritytech/parity-scale-codec).

<!--TODO: link to our own article about SCALE https://github.com/hyperledger/iroha-2-docs/issues/367-->

<!-- TODO: edit these endpoints when the decision is made about them (according to the config rfc)
## Get Configuration
- **Protocol:** HTTP
- **Method:** `GET`
- **Endpoint:** `/configuration`
There are 2 possible request bodies and according responses.
### Get Configuration Value as JSON
- **Request Body:**
```json
"Value"
```
- **Responses:**
- `200 OK`: Configuration value as JSON
### Get Documentation of a Field
- **Request Body:**
```json
{
"Docs": ["a", "b", "c"]
}
```
where "a.b.c" is a path of the field (e.g. `sumeragi.block_time_ms`).
- **Responses:**
- `200 OK`: Field was found and either doc or value is returned in json body.
- `404 Not Found`: Field wasn't found
::: tip
If the requested field has more fields inside of it, then all the documentation for its inner members is returned as
well. Here is an example for getting a field `a.b.c`:
**Example:** getting top-level documentation for `Torii` and all the fields within:
```bash
curl -X GET -H 'content-type: application/json' http://127.0.0.1:8080/configuration \
-d '{"Docs" : ["torii"]} ' -i
```
:::
## Configuration
::: warning
TODO: Will change as part of the config RFC
:::
- **Protocol:** HTTP
- **Method:** `POST`
- **Endpoint:** `/configuration`
- **Expects:**
- **Body:** One configuration option is currently supported: `LogLevel`. It is set to the log-level in uppercase.
```json
{
"LogLevel": "WARN"
}
```
Acceptable values are `TRACE`, `DEBUG`, `INFO`, `WARN`, `ERROR`.
- **Responses:**
- `200 OK`: Log level has changed successfully. The confirmed new log level is returned in the body.
- `400 Bad Request`: request body malformed.
- `500 Internal Server Error`: Request body valid, but changing the log level failed (lock contention).
-->

0 comments on commit 31d3494

Please sign in to comment.