233 lines
7.5 KiB
YAML
233 lines
7.5 KiB
YAML
openapi: 3.0.0
|
|
info:
|
|
title: API трассировки COOPOS
|
|
description: Спецификация Trace API узла COOPOS (nodeos). Включение плагина и параметры — в документации разработчика на https://coopenomics.world.
|
|
version: 1.0.0
|
|
license:
|
|
name: MIT
|
|
url: https://opensource.org/licenses/MIT
|
|
contact:
|
|
url: https://coopenomics.world
|
|
servers:
|
|
- url: '{protocol}://{host}:{port}/v1/'
|
|
variables:
|
|
protocol:
|
|
enum:
|
|
- http
|
|
- https
|
|
default: http
|
|
host:
|
|
default: localhost
|
|
port:
|
|
default: "8080"
|
|
components:
|
|
schemas:
|
|
TRACE:
|
|
type: object
|
|
properties:
|
|
global_squence:
|
|
type: integer
|
|
example: 669
|
|
receiver:
|
|
type: string
|
|
example: myproducer
|
|
account:
|
|
type: string
|
|
example: esio.token
|
|
action:
|
|
type: string
|
|
example: transfer
|
|
authorization:
|
|
type: array
|
|
items:
|
|
type: object
|
|
properties:
|
|
account:
|
|
type: string
|
|
example: myaccount
|
|
permission:
|
|
type: string
|
|
example: active
|
|
data:
|
|
type: string
|
|
$ref: "schemas/Sha256.yaml"
|
|
return_value:
|
|
type: string
|
|
example: ""
|
|
params:
|
|
type: object
|
|
properties:
|
|
from:
|
|
type: string
|
|
example: eosio
|
|
to:
|
|
type: string
|
|
example: myproducer
|
|
quantity:
|
|
type: string
|
|
example: "10.000 SYS"
|
|
memo:
|
|
type: string
|
|
example: "first transfer"
|
|
ERROR_DETAILS:
|
|
type: object
|
|
properties:
|
|
code:
|
|
type: integer
|
|
example: 0
|
|
name:
|
|
type: string
|
|
what:
|
|
type: string
|
|
details:
|
|
type: array
|
|
items:
|
|
type: string
|
|
security:
|
|
- {}
|
|
paths:
|
|
/trace_api/get_block:
|
|
post:
|
|
summary: Получить блок
|
|
description: Возвращает объект трассировки блока с отработанными действиями и сопутствующими метаданными.
|
|
operationId: get_block
|
|
requestBody:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
required:
|
|
- block_num
|
|
properties:
|
|
block_num:
|
|
type: integer
|
|
description: Номер блока
|
|
responses:
|
|
"200":
|
|
description: Успешно — корректное тело ответа
|
|
content:
|
|
application/json:
|
|
schema:
|
|
oneOf:
|
|
- $ref: "schemas/BlockTraceV0.yaml"
|
|
- $ref: "schemas/BlockTraceV1.yaml"
|
|
- $ref: "schemas/BlockTraceV2.yaml"
|
|
"400":
|
|
description: Ошибка — неверный номер блока (не число, превышает максимум int)
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
properties:
|
|
code:
|
|
type: integer
|
|
example: 400
|
|
message:
|
|
type: string
|
|
example: "bad or missing block_num"
|
|
error:
|
|
$ref: "#/components/schemas/ERROR_DETAILS"
|
|
"404":
|
|
description: Ошибка — на узле нет запрошенных данных
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
properties:
|
|
code:
|
|
type: integer
|
|
example: 400
|
|
message:
|
|
type: string
|
|
example: "bad or missing block_num"
|
|
error:
|
|
$ref: "#/components/schemas/ERROR_DETAILS"
|
|
"500":
|
|
description: Ошибка — аварийная ситуация при получении трассировки блока (например повреждённые файлы)
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
properties:
|
|
code:
|
|
type: integer
|
|
example: 500
|
|
message:
|
|
type: string
|
|
example: "Trace API encountered an Error which it cannot recover from. Please resolve the error and relaunch the process"
|
|
error:
|
|
$ref: "#/components/schemas/ERROR_DETAILS"
|
|
|
|
/trace_api/get_transaction_trace:
|
|
post:
|
|
summary: Трассировка транзакции
|
|
description: Сканирует файлы трассировки в поиске указанной транзакции.
|
|
operationId: get_transaction_trace
|
|
requestBody:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
required:
|
|
- id
|
|
properties:
|
|
id:
|
|
type: integer
|
|
description: Идентификатор транзакции
|
|
responses:
|
|
"200":
|
|
description: Успешно
|
|
content:
|
|
application/json:
|
|
schema:
|
|
oneOf:
|
|
- $ref: "schemas/TransactionTraceV0.yaml"
|
|
- $ref: "schemas/TransactionTraceV1.yaml"
|
|
- $ref: "schemas/TransactionTraceV2.yaml"
|
|
- $ref: "schemas/TransactionTraceV3.yaml"
|
|
"400":
|
|
description: Ошибка — неверный запрос (некорректный идентификатор транзакции)
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
properties:
|
|
code:
|
|
type: integer
|
|
example: 400
|
|
message:
|
|
type: string
|
|
example: "bad or missing block_num"
|
|
error:
|
|
$ref: "#/components/schemas/ERROR_DETAILS"
|
|
"404":
|
|
description: Ошибка — на узле нет запрошенных данных
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
properties:
|
|
code:
|
|
type: integer
|
|
example: 400
|
|
message:
|
|
type: string
|
|
example: "bad or missing block_num"
|
|
error:
|
|
$ref: "#/components/schemas/ERROR_DETAILS"
|
|
"500":
|
|
description: Ошибка — аварийная ситуация при получении трассировки транзакции (например повреждённые файлы)
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
properties:
|
|
code:
|
|
type: integer
|
|
example: 500
|
|
message:
|
|
type: string
|
|
example: "Trace API encountered an Error which it cannot recover from. Please resolve the error and relaunch the process"
|
|
error:
|
|
$ref: "#/components/schemas/ERROR_DETAILS"
|