Introduction to the Firehose
How does it work?
Unlike the imin Events API, the Firehose is not a search API. It is a “feed” that is compatible with the OpenActive Modelling Specification and published using the OpenActive Paging Specification (RPDE).
You read a feed from the beginning, one page at a time, and store its items in your own datastore. When you reach the end, you keep polling. The feed then gives you every item that has been added, changed or deleted since you last asked. The OpenActive page How an RPDE data feed works explains this in more detail.
The Four Feeds
The Firehose has two types of data. Each type has a parent feed and a child feed:
| Type | Parent feed | Child feed | Concepts |
|---|---|---|---|
| Events | session-series, containing SessionSeries | scheduled-sessions, containing ScheduledSessions | EventSeries |
| Facilities | facility-uses, containing FacilityUses | slots, containing Slots | FacilityUses and IndividualFacilityUses |
The parent describes the session or facility. The child is a single date and time at which it can be attended or used.
What an Item Looks Like
Every page of a feed contains a list of items. Each item has the same outer structure:
{ "state": "updated", "kind": "SessionSeries", "id": "https://firehose-cdn.imin.co/firehose-cdn/refimpl/v2/session-series/https%3A%2F%2Fexample.com%2Fsession-series%2F157", "modified": 21343296230, "data": { "@context": [ "https://openactive.io/", "https://imin.co/", "https://openactive.io/ns-beta" ], "@type": "SessionSeries", "@id": "https://firehose-cdn.imin.co/firehose-cdn/refimpl/v2/session-series/https%3A%2F%2Fexample.com%2Fsession-series%2F157", "...": "..." }}stateisupdatedordeleted. Forupdated, replace any copy you have stored withdata. Fordeleted, remove the item from your datastore. A deleted item has nodata.kindisSessionSeries,ScheduledSession,FacilityUseorFacilityUse/Slot.idis the item’s identifier. It is the same asdata["@id"].modifiedis a number that increases each time the item changes.datais the session or facility itself.
Identifiers Are Not Links
The @id of an item looks like a URL, but it is only an identifier. For example:
https://firehose-cdn.imin.co/firehose-cdn/refimpl/v2/facility-uses/https%3A%2F%2Fexample.com%2Ffacility-uses%2F1- It is guaranteed to be unique.
- It does not need to resolve to anything. Do not request it.
- Treat it as an opaque string. Store it and compare it exactly as it is given. Do not parse it, and do not build one yourself, as you cannot rely on its format.
Cross-Referencing Endpoints
A SessionSeries has one or more ScheduledSessions, and a FacilityUse has one or more Slots. Some Slots relate to an IndividualFacilityUse within a FacilityUse.
To link a child to its parent, match these fields:
- ScheduledSession to SessionSeries. The ScheduledSession’s
data.superEventmatches the SessionSeries’data["@id"]. - Slot to a FacilityUse without the
individualFacilityUseproperty. The Slot’sdata.facilityUsematches the FacilityUse’sdata["@id"]. This Slot represents an aggregation of courts (e.g. 6 badminton courts available). - Slot to a FacilityUse with the
individualFacilityUseproperty. The Slot’sdata.facilityUsematches one of the FacilityUse’sdata.individualFacilityUse[]["@id"]IDs. This Slot relates to a single court (e.g. Badminton Court 3).
A child can arrive before its parent, because the two feeds are updated separately. See Orphaned ScheduledSessions.