Создать обмен между счетами
POST
/api/v1/exchange_requests
const url = 'https://core.example.com/api/v1/exchange_requests';const options = { method: 'POST', headers: {'session-token': '<session-token>', 'Content-Type': 'application/json'}, body: '{"exchange":{"amount":1,"currency":"example","target_currency":"example","from_account_id":1,"to_account_id":1,"description":"example","otc":true}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://core.example.com/api/v1/exchange_requests \ --header 'Content-Type: application/json' \ --header 'session-token: <session-token>' \ --data '{ "exchange": { "amount": 1, "currency": "example", "target_currency": "example", "from_account_id": 1, "to_account_id": 1, "description": "example", "otc": true } }'Authorizations
Заголовок раздела «Authorizations»Request Bodyrequired
Заголовок раздела «Request Bodyrequired»Media typeapplication/json
object
exchange
required
object
amount
required
number format: double
currency
string
target_currency
string
from_account_id
required
integer
to_account_id
required
integer
description
string
otc
Передаётся banking-клиентом, но не разрешён strong params Core и фактически игнорируется
boolean
Examplegenerated
{ "exchange": { "amount": 1, "currency": "example", "target_currency": "example", "from_account_id": 1, "to_account_id": 1, "description": "example", "otc": true }}Responses
Заголовок раздела « Responses »Успешный ответ
Media typeapplication/json
object
success
required
boolean
status
required
integer
key
additional properties
any
Example
{ "success": true, "status": 200}Ошибка авторизации, валидации или бизнес-правила
Media typeapplication/json
object
success
required
boolean
status
required
integer
errors
required
One of:
Array<object>
object
code
string
kind
string
expiration
string
session
string
key
additional properties
any
object
key
additional properties
any
string
key
additional properties
any
Example
{ "success": false, "status": 403}