Specification for API.
Steps:
1. Registration.
Method type: POST
URL: /register
Request body example:
{
"password": "0a2i84a...", // password hash
"apiKey": "1a1" // api key
}
Response example:
0xfd95028685f3cd56d038a5aa19d0030cc116bbe0 // Ethereum wallet id
2. Check account balance.
Method type: GET
URL: balance/:address
Request body example: None
Response example:
0.09287612
3. Send testnet Ethers.
Method type: POST
URL: sendTestnetEthers/:address
Request body example:
{
"password": "334fmekrmm43534", // password hash
"apiKey": "1a1" // api key
}
Response example:
0x0cd67e71c298fde80c27a349ca5909e6091983b0a9dbae22ba8c96e2ef60a0fd // transaction id
4. Policy yearly price.
Method type: POST
URL: /insurancePrice/:address
Request body example:
{
"deviceBrand": "apple",
"deviceYear": "2015",
"wearLevel": "70",
"region": "africa"
}
Response example:
0.023234
5. Insure.
Method type: POST
URL: /insure/:address
Request body example:
{
"password": "334fmekrmm43534", // password hash
"apiKey": "1a1", // api key
"itemId": "112312132",
"deviceBrand": "apple",
"deviceYear": "2015",
"wearLevel": "70",
"region": "africa"
}
Response example:
0x9ba9f6fb21cb17d6dabebcb7ad6e66a919fddfcb1353cd2ea73fc7c0b9dc185a // transaction id
6. Policy end timestamp.
Method type: GET
URL: policyEndDate/:address
Request body example: None
Response example:
1530727689
7. Next payment timestamp.
Method type: GET
URL: nextPayment/:address
Request body example: None
Response example:
1530727689
8. Claimed.
Method type: GET
URL: claimed/:address
Request body example: None
Response example:
true
9. Claim.
Method type: POST
URL: claim/:address
Request body example:
{
"wearLevel": "30",
"password": "334fmekrmm43534", // password hash
"apiKey": "1a1" // api key
}
Response example:
0x94bf16d14ddb3f1f522f0968a3cc74f63468c25830b2e9e64525797396c823b1 // transaction id