Getting the latest prices for specific outcomes

Before you get the prices for a specific outcome during an event, and later use the outcome identifiers to place bets, you need to navigate through the hierarchy we have created to retrieve our pricing information (provided by the Competitions API). The hierarchy which you need to navigate through has the following structure: Categories -> Classes -> Types -> Events -> Markets -> Outcomes.

Procedure

  1. Get all available classes using the William Hill Competitions API.
    To do that, execute the following Request:
    GET /v1/competitions/classes HTTP/1.1
    Host: sandbox.whapi.com
    Accept: application/vnd.who.Sportsbook+xml;v=1;charset=utf-8
    who-apiKey: l7xxa54460c573b5497c9b24b505xxxxxxxx
        
  2. Select the class for which you want to get events for.
    You will get the following Response for the above request:
     <whoCompetitions>
       <created>2013-09-27 9:58:43</created>
       <disclaimer></disclaimer>
       <copyright>Copyright (c) 2013, WHG (International) Limited. All rights reserved.</copyright>
       <category id="1">
          <displayOrder>1</displayOrder>
          <name>American Football</name>
          <code>AMERICAN_FB</code>
          <class id="19">
             <channels>IPLYFBJSCMHQGNAEVU</channels>
             <displayOrder>9999</displayOrder>
             <name>American Football</name>
          </class>
       </category>
    </whoCompetitions>
       
  3. Get the all events in a specific class.
    To do that, execute the following Request:
    GET /v1/competitions/classes/19/types/events HTTP/1.1
    Host: sandbox.whapi.com
    Accept: application/vnd.who.Sportsbook+xml;v=1;charset=utf-8
    who-apiKey: l7xxa54460c573b5497c9b24b505xxxxxxxx
     
  4. As a response, you will get a list of all events for that class.
    You will get the following response from executing the above request:
    <whoCompetitions>
       <created>2013-09-27 9:58:43</created>
       <disclaimer></disclaimer>
       <copyright>Copyright (c) 2013, WHG (International) Limited. All rights reserved.</copyright>
       <category id="1">
          <displayOrder>1</displayOrder>
          <name>American Football</name>
          <code>AMERICAN_FB</code>
          <class id="19">
             <channels>IPLYFBJSCMHQGNAEVU</channels>
             <displayOrder>9999</displayOrder>
             <name>American Football</name>
             <type id="195">
                <channels>IPLYFBJSCMHQGNAEVU</channels>
                <displayOrder>-998</displayOrder>
                <lastUpdateDate>2015-04-08</lastUpdateDate>
                <lastUpdateTime>03:03:12</lastUpdateTime>
                <name>NFL</name>
                <url>http://sports.williamhill.com/bet/betting/t/195</url>
                <event id="7155808">
                   <name>Super Bowl 50 - Outright</name>
                   <venue/>
                   <status>A</status>
                   <date>2015-04-30</date>
                   <time>09:00:00</time>
                   <sort>TNMT</sort>
                   <channels>IPLYFBJSCMHQGNAEVU</channels>
                   <betting>
                      <untilDate>2015-04-30</untilDate>
                      <untilTime>09:00:00</untilTime>
                      <status>PRICED</status>
                   </betting>
                   <availability>
                      <inPlay>N</inPlay>
                      <livePrices>Y</livePrices>
                   </availability>
                   <inPlay>
                      <started>N</started>
                   </inPlay>
                   <url>http://sports.williamhill.com/bet/en-gb/betting/e/195/</url>
                   <raceNum/>
                   <displayed>Y</displayed>
                   <displayOrder>0</displayOrder>
                   <lastUpdateDate>2015-04-08</lastUpdateDate>
                   <lastUpdateTime>03:04:52</lastUpdateTime>
                </event>
             </type>
          </class>
       </category>
    </whoCompetitions>
       
  5. Get all the betting opportunities and specific prices for an event.
    To do that, execute the following request:
    GET /v1/competitions/events/7155808/markets/outcomes HTTP/1.1
    Host: sandbox.whapi.com
    Accept: application/vnd.who.Sportsbook+xml;v=1;charset=utf-8
    who-apiKey: l7xxa54460c573b5497c9b24b505xxxxxxxx
       
  6. You now have all the betting outcomes for a specific event.
    <whoCompetitions>
       <created>2013-09-27 9:58:43</created>
       <disclaimer></disclaimer>
       <copyright>Copyright (c) 2013, WHG (International) Limited. All rights reserved.</copyright>
       <event id="7155808">
          <name>Super Bowl 50 - Outright</name>
          <venue/>
          <status>A</status>
          <date>2015-04-30</date>
          <time>09:00:00</time>
          <numMarkets/>
          <sort>TNMT</sort>
          <channels>IPLYFBJSCMHQGNAEVU</channels>
          <betting>
             <untilDate>2015-04-30</untilDate>
             <untilTime>09:00:00</untilTime>
             <status>PRICED</status>
          </betting>
          <availability>
             <inPlay>N</inPlay>
          </availability>
          <inPlay>
             <started>N</started>
          </inPlay>
          <url>http://sports.williamhill.com/bet/en-gb/betting/e/7155808/Super%2dBowl%2d50%2d%2d%2dOutright</url>
          <flags/>
          <raceNum/>
          <displayOrder>0</displayOrder>
          <lastUpdateDate>2015-04-08</lastUpdateDate>
          <lastUpdateTime>03:04:52</lastUpdateTime>
          <market id="232821899">
             <name>Super Bowl Outright</name>
             <type>-</type>
             <sort>--</sort>
             <eachWayFactor>1/2</eachWayFactor>
             <eachWayPlaces>2</eachWayPlaces>
             <status>A</status>
             <availability>
                <eachWay>Y</eachWay>
                <startingPrice>N</startingPrice>
                <place>N</place>
                <forecast>N</forecast>
                <tricast>N</tricast>
                <quinella/>
                <firstFour/>
                <livePrice>Y</livePrice>
                <guaranteedPrice>N</guaranteedPrice>
             </availability>
             <inPlay>
                <index/>
                <delay/>
             </inPlay>
             <templateId>232</templateId>
             <displayOrder>0</displayOrder>
             <unformattedHandicap/>
             <handicap/>
             <flags/>
             <channels>IPLYFBJSCMHQGNAEVU</channels>
             <url>http://sports.williamhill.com/bet/betting/m/232821899</url>
             <lastUpdateDate>2015-04-08</lastUpdateDate>
             <lastUpdateTime>03:08:20</lastUpdateTime>
             <outcome id="786274541">
                <name>Seattle Seahawks</name>
                <status>A</status>
                <odds>
                   <livePrice>
                      <priceNum>9</priceNum>
                      <priceDen>2</priceDen>
                      <priceFrac>9/2</priceFrac>
                      <priceDec>5.50</priceDec>
                   </livePrice>
                   <history/>
                </odds>
                <results>
                   <result>-</result>
                   <type>-</type>
                </results>
                <channels>IPLYFBJSCMHQGNAEVU</channels>
                <displayOrder>0</displayOrder>
                <displayed/>
                <runnerNumber/>
                <unformattedHandicap/>
                <handicap/>
                <lastUpdateDate>2015-04-06</lastUpdateDate>
                <lastUpdateTime>01:03:11</lastUpdateTime>
             </outcome>
          </market>
       </event>
    </whoCompetitions>