Rather than using a fully custom way of representing the resources we expose in aurora, we use HAL. HAL is a hypermedia format in JSON that remains simple while giving us a couple of benefits such as simpler client integration for several languages.
At its simplest, a HAL response is just a JSON object with a couple of reserved property names:_links is used for expressing links and _embedded is used for bundling other HAL objects with the response. Other than links and embedded objects, HAL is just JSON.
HAL is a hypermedia format, like HTML, in that it has a mechanism to express links between documents. Let’s look at a simple example:
The above response is for the genesis ledger of the HC test network, and the links in the _linksattribute provide links to other relevant resources in aurora. Notice the object beneath the transactions key. The key of each link specifies that links relation to the current resource, and in this case transactions means “Transactions that occurred in this ledger”. Logically, you should expect that resource to respond with a collection of transactions with all of the results having a ledger_sequence attribute equal to 1.
The transactions link is also templated, which means that the href attribute of the link is actually a URI template, as specified by RFC 6570. We use URI templates to show you what parameters a given resource can take. You must evaluate the template to a valid URI before navigating to it.
Pages represent a subset of a larger collection of objects.
As an example, it would be unfeasible to provide the All Transactions endpoint without paging.
Over time there will be millions of transactions in the Hashcash network’s ledger and returning them all over a single request would be unfeasible.
*Powered by HashCash