cic-docs/spec/015_accounts_api_extension.md

81 lines
1.2 KiB
Markdown
Raw Normal View History

2020-08-10 09:13:45 +02:00
# API EXTENSIONS FOR INDEPENDENT TRANSFER ACCOUNTS
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_.
## ADDED METHODS
Endpoints _added_ are found under /api/ext/
### `/api/ext/transfer_account/register/`
#### **POST**
Create a new transfer_account bound to an organisation.
Request payload:
```
{
address: <address>,
organisation_id: <uint>,
}
```
Response payload on success:
```
{
message: 'Created',
data: {
id: <uint>
},
}
```
`id` is the id of the newly created transfer account
Returns:
```
201 - transfer account is added
400 - address or organisation data invalid
404 - organisation not found
```
### `/api/ext/user/`
#### **POST**
Add a new user without transfer account. The user will be associated with the organisation in the API session context.
Request payload:
```
{
phone: <string>,
first_name: <string>,
last_name: <string>,
}
```
Response payload on success:
```
{
data: {
id: <uint>
},
}
```
`id` is the id of the newly created user.
Returns:
```
201 - user created
400 - organisation context missing
```