cic-docs/spec/012_multitoken_platform_api_extension.md

71 lines
1.3 KiB
Markdown
Raw Normal View History

2020-08-10 09:13:45 +02:00
# API EXTENSIONS FOR EXTERNALLY CREATED BLOCKCHAIN RESOURCES
At time of writing, apis are registered under `/api/v2`. This will change.
## NOMENCLATURE
Values enclosed with `<>` are _required_.
Values enclosed with `[]` means _optional_.
No enclosure means _literal_.
## CHANGED METHODS
Endpoints _modified_ are found under /api/v1/
Changes will be submitted upstream.
### `/api/v1/organisation`
### **POST**
One item is added to data payload:
```
{
account_address: [address],
}
```
If specified, the organisation will be bound to the specified blockchain account, and _will not_ create a new account on instantiation.
## ADDED METHODS
Endpoints _added_ are found under /api/ext/
### `/api/ext/exchange/register`
#### **POST**
Creates a new entry in `exchange_contract` table in database.
Requires token addresses to be registered in advance on `/api/v1/token/`
Request payload:
```
{
reserve_address: <address>,
token_address: <address>,
converter_address: <address>,
registry_address: <address>,
connector_weight: <uint>,
}
```
Response payload on success:
```
{
message: 'Exchange added',
data: {
exchange: (exchange schema dump, TODO specify)
}
}
```
Returns:
```
201 - exchange record created
400 - token addresses not known to platform
```