diff --git a/spec/012_multitoken_platform_api_extension.md b/spec/012_multitoken_platform_api_extension.md new file mode 100644 index 0000000..bad84fb --- /dev/null +++ b/spec/012_multitoken_platform_api_extension.md @@ -0,0 +1,70 @@ +# 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:
, + token_address:
, + converter_address:
, + registry_address:
, + connector_weight: , +} +``` + +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 +``` diff --git a/spec/013_locations_api_extension.md b/spec/013_locations_api_extension.md new file mode 100644 index 0000000..c5b45ae --- /dev/null +++ b/spec/013_locations_api_extension.md @@ -0,0 +1,102 @@ +# API EXTENSIONS FOR MANIPULATING LOCATIONS RECORDS + +## 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/geolocation/` + +#### **POST** + +Adds a location entry to the database + +Request payload: +``` +{ + common_name: , + latitude: , + longitude: , + parent_id: [uint], +} + +``` + +`parent_id` is the location table id of the location record for the greater area encapsulating the location being registered. + +### `/api/ext/geolocation//` + +#### **GET** + +Retrieves a location record based on the given `path_string`. Every part of the given path string must match the value in the location hierarchy. A path string must have minimum one part. + +Example, given database has `foo/bar` and `foo/baz`: A search of `foo/bar` will only match `foo/bar`. A search of `foo` will match both `foo/bar` and `foo/baz`. + +Response payload: + +``` +{ + id: , + common_name: , + path: , + latitude: , + longitude: , +} + +``` + +`common_name` is the location leaf name. + +`path` is the full hierarchical path string. + +### `/api/ext/geolocation///` + + +#### **GET** + +Queries the `location_external` table for a matching value, and returns the `location` object associated with it. + +Currently only `OSM` is supported as `ext_type`. The value given matches a `place_id` entry in the external table. + +Data format returned the same as `GET /api/ext/geolocation//` + +### `/api/ext/user//geolocation/` + +#### **PUT** + +Sets the location of the affected user + +Data payload: + +``` +{ + location_id: +} +``` + +#### **GET** + +Retrieves full objects for the hierarchical path of the user location. + +Response payload: + +``` +{ + user_id: user_id, + location: [ + { + common_name: , + longitude: , + latitude: , + }, + ... + ], +} +``` diff --git a/spec/015_accounts_api_extension.md b/spec/015_accounts_api_extension.md new file mode 100644 index 0000000..2b4b7fd --- /dev/null +++ b/spec/015_accounts_api_extension.md @@ -0,0 +1,80 @@ +# 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:
, + organisation_id: , +} +``` + +Response payload on success: +``` +{ + message: 'Created', + data: { + id: + }, +} +``` + +`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: , + first_name: , + last_name: , +} +``` + +Response payload on success: +``` +{ + data: { + id: + }, +} +``` + +`id` is the id of the newly created user. + +Returns: +``` +201 - user created +400 - organisation context missing +```