Links
What do relationships between resources look like.
A number of the sport API resources expose document reference links to help with logic and navigation. For example, a sporting event could potentially have Actions or a Composition view but as a client you do not want to request this data to find nothing there. In this example, you could use the links to flag if there is content available for you to get and where to get it from.
The example below shows what an example link would look like for an available composition.
curl http:sport.api.press.net/v1/event/2371931
{
"id": 2371931,
"name": "Omega Dubai Desert Classic",
"status": "Finished",
"date": "2017-02-02T03:15:00Z",
"updated": "2017-02-07T14:08:33Z",
"...": "...",
"links": [
{
"rel": "self",
"href": "http://sport-uat.api.press.net/v1/event/2371931"
},
{
"rel": "event-composition",
"href": "http://sport-uat.api.press.net/v1/event/2371931/composition"
}
]
}
<?xml version="1.0" encoding="utf-8" ?>
<pa:sports-content xmlns="http://iptc.org/std/nar/2006-10-01/" xmlns:pa="http://sport-api.pa.press.net/2016-09-30/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<pa:sports-metadata doc-id="http://sport-uat.api.press.net/v1/event/2371931?apikey=allsports" document-class="pa:event-detail">
<sports-title>Omega Dubai Desert Classic</sports-title>
</pa:sports-metadata>
<pa:sports-event id="event.2371931">
<event-metadata start-date-time="2017-02-02T03:15:00Z" event-status="pa:finished">
<sports-content-codes>
<sports-content-code code-type="pa:sport" code-key="sport:3" code-name="Golf"/>
<sports-content-code code-type="pa:tournament" code-key="tournament:429" code-name="European Tour"/>
<sports-content-code code-type="pa:season" code-key="season:10838" code-name="2017"/>
<sports-content-code code-type="pa:stage" code-key="stage:846196" code-name="Omega Dubai Desert Classic"/>
<sports-content-code code-type="pa:event" code-key="event:2371931" code-name="Omega Dubai Desert Classic" xsi:type="pa:sportsContentCodeComplexType">
<pa:link pa:href="http://sport-uat.api.press.net/v1/event/2371931/composition" pa:rel="event-composition"/>
</sports-content-code>
</sports-content-codes>
<sports-property formal-name="event:last-updated" value="2017-02-05T12:57:14Z"/>
<sports-property formal-name="event:live" value="yes"/>
<sports-property formal-name="event:rounds" value="4"/>
<sports-property formal-name="event:type" value="Stroke Play"/>
<sports-property formal-name="common:updated" value="2017-02-07T14:08:33Z"/>
<name>Omega Dubai Desert Classic</name>
</event-metadata>
...
</pa:sports-event>
</pa:sports-content>
As you can see in the example the links array contains the relationship to event composition using the 'event-composition' key, the location of the resource can be found using the href key.
The XML content contains this information in the pa:link element found within the pa:event sport-content-code.
The table below shows what relationships are available for each resource:
Resource | Relationships |
---|---|
Sport | standing |
Tournament | standing |
Season | standing |
Stage | standing |
Event | event-composition |
Event | event-actions |
Event | event-report |
Updated about 6 years ago