All responses from WCEA API come with an envelope, which contains meta information, such as Status
and Count
.
In the case of responses that contain a list, the metadata also contains pagination hints indicating where we are on the list and how many items are still left etc.
The metadata object also contains a links
sub-object, which contains HATEOAS links related to the current resource.
For list type responses, pagination links are provided as a convenience allowing you to jump from page to page, as well as links to the first and last pages where appropriate.
For responses that contain a single resource, any related resource urls are also available as HATEOAS links inside the metadata links
object.
Metadata Properties
status | Either SUCCESS or ERROR depending on whether there was an error |
||||
---|---|---|---|---|---|
count | total number of items returned in this response | ||||
offset | only shows up on list type resources, contains the current data offset | ||||
total | only shows up on list type resources, contains the total number of items in the list | ||||
links |
sub-object containing links either to related resources, or pagination links. The key for each link contains the relation from the current resource to the linked resource:
|
Anatomy of a metadata object
{ "_meta":{ //metadata container "status":"SUCCESS", "count":1, "total":200, "offset":0, "links":[ "first":{ "method":"GET", "uri":"/v1.1/user?offset=0&limit=20" } ], }, "records":{ //payload container ... } }
links
object contains HATEOAS links.
The key for each link indicates the relation, in this case first
indicates that the link will take you to the first page.