Complete markdown documentation
Deploy / deploy (push) Successful in 37s
CI / Rust Checks (push) Successful in 27m22s
CI / UI Checks (push) Successful in 6s
CI / Deployment Manifests (push) Successful in 3s
CI / Frontend E2E (push) Successful in 20m44s

This commit is contained in:
github-ops
2026-06-21 12:49:56 +00:00
parent c77065756d
commit 9331ee1d89
11 changed files with 680 additions and 135 deletions
+139
View File
@@ -0,0 +1,139 @@
# Практические API-примеры
Здесь собраны минимальные запросы для проверки Crank без веб-интерфейса.
В примерах используется:
```text
https://crank.example.com
```
Замените адрес на свой.
## Вход
```bash
curl -i https://crank.example.com/api/auth/login \
-H 'Content-Type: application/json' \
--data '{
"email": "owner@example.com",
"password": "change-me"
}'
```
Сохраните cookie `crank_session`.
## Получить workspace
```bash
curl https://crank.example.com/api/admin/workspaces \
-b 'crank_session=<cookie_value>'
```
Для стандартной установки workspace id:
```text
ws_default
```
## Получить операции
```bash
curl https://crank.example.com/api/admin/workspaces/ws_default/operations \
-b 'crank_session=<cookie_value>'
```
После demo seed ожидается операция:
```text
frankfurter_latest_rate
```
## Запустить тест операции
```bash
curl https://crank.example.com/api/admin/workspaces/ws_default/operations/<operation_id>/test-runs \
-b 'crank_session=<cookie_value>' \
-H 'Content-Type: application/json' \
--data '{
"version": 1,
"input": {
"base": "USD",
"quote": "EUR"
}
}'
```
## Получить агентов
```bash
curl https://crank.example.com/api/admin/workspaces/ws_default/agents \
-b 'crank_session=<cookie_value>'
```
После demo seed ожидается агент:
```text
currency-rates
```
## Создать API-ключ агента
```bash
curl https://crank.example.com/api/admin/workspaces/ws_default/agents/<agent_id>/platform-api-keys \
-b 'crank_session=<cookie_value>' \
-H 'Content-Type: application/json' \
--data '{
"name": "Manual MCP test",
"scopes": ["read", "write"]
}'
```
Сохраните поле `secret`. Оно не будет показано повторно.
## Проверить MCP initialize
```bash
curl -i https://crank.example.com/mcp/v1/default/currency-rates \
-H 'Authorization: Bearer <agent_api_key>' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
--data '{
"jsonrpc": "2.0",
"id": 1,
"method": "initialize",
"params": {
"protocolVersion": "2025-06-18",
"capabilities": {},
"clientInfo": {
"name": "curl",
"version": "1.0.0"
}
}
}'
```
Сохраните `MCP-Session-Id` из заголовков ответа.
## Вызвать инструмент
```bash
curl https://crank.example.com/mcp/v1/default/currency-rates \
-H 'Authorization: Bearer <agent_api_key>' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'MCP-Session-Id: <session_id>' \
--data '{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "frankfurter_latest_rate",
"arguments": {
"base": "USD",
"quote": "EUR"
}
}
}'
```