The API uses the REST API standard.
The host you could find here: http://pdms.robin8.io.
Commonly integer numbers storing in the blockchains.
If you want to store float number in the blockchain, you should multiply it on some constant (for instance, 10^8 for QTUM).
Therefore, variables amount, balance, offer_price, price, buyer_price and seller_price represented as x * 10^8. Where x could be float.
Variable timestamp has the following format %Y%m%d%H%M. For instance, timestamp 201806081300 means 2018 June 8 13:00.
For checking status of the transaction in the QTUM blockchain use the following site https://testnet.qtum.org.
Your data is written to the blockchain when the status of the transaction changes from Unconfirmed to Success.
The API-methods:
The following is a description of the API-methods:
-
URL:
/api/accounts -
Method:
POST -
URL params
None
-
Body params
[json]Optional:
phoneandemailRequired:
device_id
{
"public_key": [string],
"message": {
"email": [string],
"device_id": [string],
"phone": [string],
"timestamp": [string]
},
"signature": [string]
}-
Sample response
[json]If such account already exists user receives a
Unique violation error.balancerepresented asreal_user_balance * 10^8. Wherereal_user_balancecould befloat.After successful account creation user receives the response with following structure:
{
"count": [integer], # number of user's wallets
"device_id": [string],
"email": [string],
"href": [string], # link to user account
"level": [integer], # user account level (2 - when balance is zero ( by default), 3 - when balance is not null)
"public_key": [string],
"news_count": [integer], # number of news about offers to buy profile (0 by default)
"id": [integer], # user's identifier
"wallets": [string], # list of dicts with user's wallets addresses
"address": [string], # wallet address
"amount": 0 [integer], # current balance
"deposit": 0 [integer], # freezed balance
"unconfirmed": 0 [integer], # unconfirmed balance
"coinid": [string] # type of blockchain
}-
URL:
/api/accounts/[public_key] -
Method:
GET -
URL params
[json]
{
"public_key": [string],
"message": {
"timestamp": [string]
},
"signature": [string]
}-
Body params
None
-
Sample response
[json]balancerepresented asreal_user_balance * 10^8. Wherereal_user_balancecould befloat.
{
"count": [integer], # number of user's wallets
"device_id": [string],
"email": [string],
"href": [string], # link to user account
"level": [integer], # user account level (2 - when balance is zero ( by default), 3 - when balance is not null)
"public_key": [string],
"news_count": [integer], # number of news about offers to buy profile (0 by default)
"id": [integer], # user's identifier
"wallets": [string], # list of dicts with user's wallets addresses
"address": [string], # wallet address
"amount": 0 [integer], # current balance
"deposit": 0 [integer], # freezed balance
"unconfirmed": 0 [integer], # unconfirmed balance
"coinid": [string] # type of blockchain
}-
URL:
/api/accounts/[public_key]/news -
Method:
GET -
URL params
[json]
{
"public_key": [string],
"message": {
"timestamp": [string]
},
"signature": [string]
}-
Body params
None
-
Sample response
[json]When the user sends an offer to buy profile
event_typeis 'made offer'.buyer_priceandseller_pricerepresented asreal_price * 10^8. Wherereal_pricecould befloat.
[
{
"event_type": [string], # type of news
"access_string": [string], # now it is user's public key
"cid": [integer], # profile identifier
"buyer_address": [string], # buyer address
"buyer_pubkey": [string], # buyer public key
"buyer_price": [integer], # proposed buyer price * 10^8
"seller_price": [integer], # profiles price * 10^8
"coinid": [string] # blockchain identifier
"offer_type": [string] # offers type
}
]-
Description
News about actions with user profile.
-
URL:
/api/blockchain/[public_key]/profile -
Method:
POST -
URL params
None
pricerepresented asreal_price * 10^8. Wherereal_price(price of profile) could befloat. -
Body params
'[json]'
{
"public_key": [string],
"message": {
"timestamp": [string],
"cus": [string], # profile encrypted with private key
"read_access": [integer], # profile read access price * 10^8
"write_access": [integer], # profile write access price * 10^8
"description": [string] # profile description
},
"signature": [string]
}-
Sample response
[json]
{
"owneraddr": [string], # owners address
"description": [string], # profiles description
"read_price": [integer], # read access price
"write_read": [integer] # write access price
}-
URL:
/api/blockchain/[cid]/[coinid]/profile -
Method:
GET -
URL params
cid=[string]'coinid=[string]' -
Body params
None
-
Sample response
[json]pricerepresented asreal_price * 10^8. Wherereal_pricecould befloat.
{
"cid": [integer], # profile identifier
"coinid": [string], # blockchain identifier
"description": [string], # profile description
"owner": [string], # owner public key
"owneraddr": [string], # owner address
"read_access": [integer], # profiles read access price * 10^8
"write_access": [integer], # profiles write access price * 10^8
"content": [string], # profile
"seller_access_string": [string], # seller access string
"seller_pubkey": [string], # seller public key
"access_type": [string] # access type of profile
}-
Description
Return profile from the blockchain by profile id
in progress
-
URL:
/api/blockchain/[cid]/description -
Method:
POST -
URL params
cid=[string] -
Body params
[json]
{
"public_key": [string],
"message": {
"timestamp": [string],
"cid": [integer],
"description": [string]
},
"signature": [string]
}-
Sample response
[json]
{
"cid": [integer], # profiles cid
"description": [string], # profiles new description
"owneraddr": [string], # owner address
"coinid": [string] # blockchain identifier
}in progress
-
URL:
/api/blockchain/[cid]/price -
Method:
POST -
URL params
'cid=[string]'
-
Body params
[json]
{
"public_key": [string],
"message": {
"timestamp": [string],
"cid": [integer],
"price": [integer]
},
"signature": [string]
}-
Sample response
[json]
{
"cid": [integer], # profiles cid
"write_access" or "read_access": [integer] # new profiles write access or read access price
"coinid": [string] # blockchain identifier
}-
URL:
/api/blockchain/[public_key]/write-access-offer -
Method:
POST -
URL params
'public_key=[string]'
-
Body params
[json]
{
"message": {
"timestamp": [string],
"cid": [integer], # profiles identifier
"coinid": [string], # blockchain identifier
"price": [integer], # write access price (optional, sellers price by default)
"buyer_access_string": [string] # now it is user's public key
},
"signature": [string]
}-
Sample response
[json]offer_pricerepresented asreal_offer_price * 10^8. Wherereal_offer_pricecould befloat.
{
"cid": [integer], # profile identifier
"buyer_address": [string], # buyer address
"buyer_access_string": [string], # now it is buyer's public key
"offer_price": [integer], # price of profile * 10^8
"offer_type": [string] # offers type (write access)
}-
URL:
/api/blockchain/[public_key]/read-access-offer -
Method:
POST -
URL params
'public_key=[string]'
-
Body params
[json]
{
"message": {
"timestamp": [string],
"cid": [integer], # profiles identifier
"coinid": [string], # blockchain identifier
"price": [integer], # read access price (optional, sellers price by default)
"buyer_access_string": [string] # now it is user's public key
},
"signature": [string]
}-
Sample response
[json]offer_pricerepresented asreal_offer_price * 10^8. Wherereal_offer_pricecould befloat.
{
"cid": [integer], # profile identifier
"buyer_address": [string], # buyer address
"buyer_access_string": [string], # now it is buyer's public key
"offer_price": [integer], # price of profile * 10^8
"offer_type": [string] # offers type (read access)
}-
URL:
/api/blockchain/[public_key]/deal -
Method:
POST -
URL params
'public_key=[string]'
-
Body params
[json]
{
"public_key": [string],
"message": {
"timestamp": [string],
"cid": [integer], # profile identifier
"buyer_access_string": [string], # now it is user's public key
"buyer_pubkey": [string], # buyer public key
"seller_access_string": [string],
"access_type": [string], # write access or read access
"coinid": [string] # blockchain identifier
},
"signature": [string]
}-
Sample response
[json]
{
"cid": [integer], # profile identifier
"access_string": [string], # now it is user's public key
"new_owner": [string], # address of the new owner
"prev_owner": [string] # address of the previous owner
}-
URL:
/api/blockchain/[public_key]/write-access-offer -
Method:
PUT -
URL params
'public_key=[string]'
-
Body params
[json]buyer_addressis address of user who sent "make offer" request for buying profile.
{
"public_key": [string],
"message": {
"timestamp": [string],
"offer_id": {
"cid": [integer], # profile identifier
"buyer_address": [string] # buyer address
}
},
"signature": [string]
}-
Sample response
[json]
{
"cid": [integer], # profile identifier
"buyer_address": [string] # buyer address
}-
URL:
/api/blockchain/[public_key]/read-access-offer -
Method:
PUT -
URL params
'public_key=[string]'
-
Body params
[json]buyer_addressis address of user who sent "make offer" request for buying profile.
{
"public_key": [string],
"message": {
"timestamp": [string],
"offer_id": {
"cid": [integer], # profile identifier
"buyer_address": [string] # buyer address
}
},
"signature": [string]
}-
Sample response
[json]
{
"cid": [integer], # profile identifier
"buyer_address": [string] # buyer address
}-
URL:
/api/blockchain/profile -
Method:
GET -
URL params
None
-
Body params
None
-
Sample response
[json]pricerepresented asreal_price * 10^8. Wherereal_pricecould befloat.
[
{
"cid": [integer], # profile identifier
"coinid": [string], # blockchain identifier
"description": [string], # profile description
"owneraddr": [string], # owner address
"read_access": [integer], # profile read access price * 10^8
"write_access": [integer], # profile write access price * 10^8
"txid": [string] # transaction status reference
},
...
]-
URL:
/api/accounts/[public_key]/profiles -
Method:
GET -
URL params
[json]
{
"public_key": [string],
"message": {
"timestamp": [string]
},
"signature": [string]c.
}-
Body params
None
-
Sample response
[json]pricerepresented asreal_price * 10^8. Wherereal_pricecould befloat.
[
{
"cid": [integer], # profile identifier
"coinid": [string] # blockchain identifier
"description": [string], # profile description
"owneraddr": [string], # owner address
"read_access": [integer], # profile read access price * 10^8
"write_access": [integer], # profile write access price * 10^8
"txid": [string] # transaction status reference
},
...
]-
URL:
/api/accounts/[public_key]/output-offers -
Method:
GET -
URL params
[json]
{
"public_key": [string],
"message": {
"timestamp": [string]
},
"signature": [string]
}-
Body params
None
-
Sample response
[json]
[
{
"buyer_access_string": [string],
"buyer_address": [string], # buyers address
"cid": [integer], # profiles identifier
"price": [integer], # offers price
"seller_access_string": [integer], # profile price * 10^8
"type": [string], # offers type
"coinid": [string], # blockchain identifier
"status": [integer], # offer status
"seller_public_key": [string] # seller public key
},
...
]-
Description
Get all offers which made the user for buying access or rights of profiles
-
URL:
/api/accounts/[public_key]/input-offers -
Method:
GET -
URL params
[json]
{
"public_key": [string],
"message": {
"cid": [integer],
"timestamp": [string],
"coinid": [string]
},
"signature": [string]
}-
Body params
None
-
Sample response
[json]buyer_priceandseller_pricerepresented asreal_price * 10^8. Wherereal_pricecould befloat.
[
{
"buyer_access_string": [string],
"buyer_address": [string], # buyers address
"cid": [integer], # profiles identifier
"price": [integer], # offers price
"seller_access_string": [integer], # profile price * 10^8
"type": [string], # offers type
"coinid": [string], # blockchain identifier
"status": [integer], # offer status
"seller_public_key": [string] # sellers public key
},
...
]-
URL:
/api/accounts/[public_key]/deals -
Method:
GET -
URL params
None
-
Body params
None
-
Sample response
[json]
[
{
"cid": [integer], # profile identifier
"coinid": [string] # blockchain identifier
"description": [string], # profile description
"owneraddr": [string], # owner address
"read_access": [integer], # profile read access price * 10^8
"write_access": [integer], # profile write access price * 10^8
"txid": [string], # transaction status reference
},
]-
URL:
/api/accounts/[public_key]/review -
Method:
POST -
URL params
None
-
Body params
{
"message": {
"cid": [integer], # profile identifier
"timestamp": [string],
"coinid": [string], # blockchain identifier
"review": [string], # review
"rating": [integer] # profiles rating in range from 1 to 5
},
"signature": [string]
}-
Sample response
[json]
[
{
"review": [string], # review
"rating": [integer] # profiles rating in range from 1 to 5
"cid": [integer] # profiles identifier
},
...
]-
URL:
/api/accounts/[cid]/[coinid]/reviews -
Method:
GET -
URL params
None
-
Body params
None
-
Sample response
[json]
[
{
"review": [string], # review
"rating": [integer] # profiles rating in range from 1 to 5
"buyer_address": [integer] # buyers address
"confirmed": [integer] # 1 by default
},
...
]A standard error answer from the server has the following structure:
{
"error": [integer],
"reason": [string]}Where error contains an error code, while reason contains error description.