Obtaining events
Story
As an API consumer I want to be able to retrieve all members of a collection So that I can process them further.
Example
As an application user I want to display all my events So I can find out what awaits me in the nearest future.
Usage
const events = await hydraClient.getResource("http://example.com/api/events");
for (const member of events.members) {
// do something with the *member*, i.e. display it
}
Details
Once the application obtained a discovered either from the entry-point or the API documentation URL to the events, it sends a GET request to that URL and fetches the events:
GET /api/events
HTTP 200 OK
{
"@context": "/api/context.jsonld",
"@id": "/api/events",
"@type": "Collection",
"manages": {
"property": "rdf:type",
"object": "schema:Event"
},
"totalItems": 1,
"member": [
{
"@id": "/api/events/1",
"eventName": "Event 1",
"eventDescription": "Some event 1",
"startDate": "2017-04-19",
"endDate": "2017-04-19"
}
]
}
It is possible now to display one event in the calendar.
Considerations
Extensions
Please refer to this document for possible extension considerations.