Getting hashes: submitting a GET Request to our rest API
GET REQUEST
Getting hashes can be done by submitting a GET Request to our rest API.
cURL command:
curl "https://stellarapi.io/gethash/{64char-id}".
Important:
- The provided transaction-id must have the length of 64 characters. If not, an error message will be returned
- The average time a ledger closes is 5,5 seconds. When you try to get a hash that is stored only a second ago, you will not be able to retrieve the hash. Try again in a couple of seconds (error message is given).
Examples (json output):
https://stellarapi.io/gethash/9b30fd3f424ba... (successful)
https://stellarapi.io/gethash/wronghash (failure, wrong trans.id)
https://stellarapi.io/gethash/9b30fd3f424ba... (failure, empty result)
Example (pdf output):
https://stellarapi.io/gethash/9b30fd3f424ba.../pdf
JSON RESPONSE
In case of success:
{"status":"success",
"code":200,
"message":"storing hash succesfull",
"executiontime":0.323
"GMT-timestamp":"2019-07-12T16:03:08Z"
"memotype":"hash"
"memo":"KMVvhSYR..."
"memo-hexformat":"28c56f8526..."
"stellar-link":"https://stellarscan.io/transaction/GB4YU5VB..."
}
Extra information on returned JSON:
- memo: the hash is stored in binairy format on the stellar blockchain. Standard output is base64 encoded raw output (44 chars).
- memo (hex. format): hash in 'normal' hexadecimal format (64 chars.). Conversion is done by: >bin2hex(base64_decode(--hash--))
In case of failure:
{"status":"Bad Request",
"status":400,
"message":"Bad request: --error message--"
}