All top-level API resources have support for bulk fetches via "list" API methods. For instance, you can list blueprints
, list streams
, and list events
. These list API methods share a common structure, taking at least these three parameters: limit
, offset
, and order_by
.
Hal's list API methods utilize offset-based pagination via the limit
and offset
parameters. Both parameters take an integer value (see below) and return objects in the order defined by the order_by
parameter.
Parameter | Values | Description |
---|---|---|
limit | integer value from 1 - 25 | Limit controls wow many results will be fetched. This can vary from 1 to a maximum of 25 |
offset | integer value | Offset controls from what result you will start reading |
sort_by | string enum value | describes the attribute and direction you want to sort the results by. |
Example
This will get the first 25 events of a given stream, the ones from 1-25
curl --request GET \ --url 'https://apigw.hal.xyz/streams/<streamID>/events?limit=25&offset=0&sort_by=createdAt.desc' \ --header 'Accept: application/json' --header 'X-Api-Key: 8c9CeVHl6JdYBrFEFeJZYy0r8Wg3coUP
This will get the next 25 events of a given stream, the ones from 26-50
curl --request GET \ --url 'https://apigw.hal.xyz/streams/<streamID>/events?limit=25&offset=25&sort_by=createdAt.desc' \ --header 'Accept: application/json' --header 'X-Api-Key: 8c9CeVHl6JdYBrFEFeJZYy0r8Wg3coUP