API Documentation Polygon
Discover how to use OYB's API to automate your process and validate the documents on the blockchain, providing the user a timestamp proof of the document's existence.
Table of Contents
Introduction
The OYB’s API allows you to automate your operations by validating documents, checking their existence in the Polygon blockchain. By using the API, you will never have to submit your files, instead you will have to send a SHA-256 hash of the file(s). The hash is the only information stored on the blockchain, and allows other people to find out if your file actually existed in a period of time.
Example
Let’s say you are writing a book – and before selling it – somebody steals the content of your book to sell it on his own. How could you prove the original book was written by you? OYB allows you to do that.
Authentication
Access to API requires an API Token and the token is connected to an account.
You can request a test account by sending an email to: Click Here
Using simple authentication.
You can get the api token also by loggin in your account at:
https://apiproxy.ownyourbusiness.tech/accounts/login/
Example:
curl --user {someuser}:{password} --request GET \
https://apiproxy.ownyourbusiness.tech/dapp/api/get-auth-token/
The server replies with a json containing the token:
{
"token":"01234567890abcdef01234567890abcdef",
"user_id":2,
"email":""
}
Api token must be added to the request headers for method you are calling:
"Authorization: Token 01234567890abcdef01234567890abcdef"
A test account allows you to operate only on the Polygon Testnet, with strict restrictions.
URL
The URL to use in order to send an API request is the following:
https://apiproxy.ownyourbusiness.tech/{method}
OYB API interacts through POST and GET requests, no other HTTP methods are involved.
Validation
Endpoint
[POST] /dapp/api/document/{hash}
To validate a document you need to call the endpoint by http POST.
curl -X POST 'https://apiproxy.ownyourbusiness.tech/dapp/api/document/0x64c5dab1a0a9933c126107903a4c5fddccce2bcef23a9b3c66f5aaa8396ecc3a' \
-H 'Authorization: Token 01234567890abcdef01234567890abcdef'
Parameters
- hash*: the hash (SHA256) of the file(s) you need to validate.
- Token*: customer recognition
* required
Response
{
"owner":"0x97aCA75e52D5283180a90037439fC5D6b5E7e6F2",
"timestamp":1636293670,
"next":"0x00000000000000000000000…0000000000000000"
}
Verification
Endpoint
[GET] /dapp/api/document/{hash}
curl -X GET 'https://apiproxy.ownyourbusiness.tech/dapp/api/document/0x4a0874a12ce005e142911f34c3e2db680516cafea874d3eda26b8deb0c7bb20a' \
-H 'Authorization: Token 01234567890abcdef01234567890abcdef'
Parameters
* required
Response
{
"owner":"0x97aCA75e52D5283180a90037439fC5D6b5E7e6F2",
"timestamp":1636293670,
"next":"0x00000000000000000000000…0000000000000000"
}
A response containing all document data cleared means that the document has not been validated:
{
"owner":"0x0000000000000000000000000000000000000000",
"timestamp":0,
"next":"0x0000000000000000000000000000000000000000000000000000000000000000"
}
validatedBy are UNIX timestamps.