How to retrieve selection names?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • SteveDev
    Junior Member
    • Oct 2018
    • 11

    #1

    How to retrieve selection names?

    Hi all

    New to the API, am using it to provide suggested inputs / results checking for an app I'm building for a client. For the record, I'm not a gambler so the terminology is all new to me.

    I currently have the app suggesting events for the user (using the betfar API). Now I need a list of possible options for the bet, so the user doesn't have to type out the selection each time they enter a bet.

    I'm struggling to find a way to retrieve selection names, I can only seem to get IDs and some other, not required data.

    I'm using listMarketBook and getting a reponse like,

    Code:
    0 => {#344 ▼
        +"marketId": "1.150067515"
        +"isMarketDataDelayed": true
        +"status": "OPEN"
        +"betDelay": 0
        +"bspReconciled": false
        +"complete": true
        +"inplay": false
        +"numberOfWinners": 2
        +"numberOfRunners": 7
        +"numberOfActiveRunners": 6
        +"totalMatched": 0.0
        +"totalAvailable": 3524.44
        +"crossMatching": false
        +"runnersVoidable": false
        +"version": 2473426418
        +"runners": array:7 [▼
          0 => {#331 ▼
            +"selectionId": 16444868
            +"handicap": 0.0
            +"status": "ACTIVE"
            +"adjustmentFactor": 37.12
            +"totalMatched": 0.0
          }
          1 => {#341 ▼
            +"selectionId": 19048818
            +"handicap": 0.0
            +"status": "ACTIVE"
            +"adjustmentFactor": 33.013
            +"totalMatched": 0.0
          }
          .....
    How can I get more details on each selection?

    I'd really appretiate any help or pointers for this.

    Cheers.
  • BetfairDeveloperProgram
    Administrator
    • Oct 2008
    • 680

    #2
    Hi SteveDev

    You need to use listMarketCatalogue to retrieve selection names and other related data.

    Please see an example request and response via https://docs.developer.betfair.com/d...entinformation

    Use marketProjection (listMarketCatalogue) and priceProjection (listMarketBook) to specify the specific data you want. The getting started examples also include details of how to retrieve price data etc from listMarketBook

    Thanks

    Neil

    Comment

    • SteveDev
      Junior Member
      • Oct 2018
      • 11

      #3
      Nice, thanks Neil. I appretiate the quick response

      Comment

      • newbie99
        Junior Member
        • Dec 2018
        • 62

        #4
        Along similar lines, I can't work out how to view a single runner name.

        In essence, I'm trying to create a table which shows bets placed (current/settled/matched etc.) and rather than selectionId, on-screen I'd rather show the 'runner_description' field.

        I can get an array of runners for the relevant market, of which the selectionId in question will be one of them, however I can't work out from the API documentation the correct way to filter out the additional selectionId's.

        Is this possible (I appreciate there are other ways of doing this, but I wanted to find a 'clean' way, using the API itself, rather than messing around with the array data using native php functions etc)?
        Last edited by newbie99; 21-12-2018, 01:08 AM.

        Comment

        • LetsGo
          Senior Member
          • Oct 2018
          • 112

          #5
          In the listMarketCatalogue you have the listRunnerDescription.
          The listRunnerDescription list has "selectionId" and "runnerName"

          Comment

          • newbie99
            Junior Member
            • Dec 2018
            • 62

            #6
            Originally posted by LetsGo View Post
            In the listMarketCatalogue you have the listRunnerDescription.
            The listRunnerDescription list has "selectionId" and "runnerName"
            Yes, I appreciate that, but there doesn't appear to be a way to filter by selectionId, so you always end up returning all runners, which is inefficient (I appreciate having all the data I can manipulate it to hide the runners I don't wish to show).

            I was hoping to be able to request a specific selectionId and therefore only return the runner in question I wanted is that a possibility?
            Last edited by newbie99; 21-12-2018, 01:33 PM.

            Comment

            • SteveDev
              Junior Member
              • Oct 2018
              • 11

              #7
              Originally posted by newbie99 View Post

              I was hoping to be able to request a specific selectionId and therefore only return the runner in question I wanted is that a possibility?
              I think that listRunnerBook will be what you need - https://docs.developer.betfair.com/d...listRunnerBook

              Comment

              • newbie99
                Junior Member
                • Dec 2018
                • 62

                #8
                Originally posted by SteveDev View Post

                I think that listRunnerBook will be what you need - https://docs.developer.betfair.com/d...listRunnerBook
                Firstly, apologies for the slow response!

                I don't believe that works unfortunately as although you can get a lot of info, it doesn't allow you to get the Runner Name field.

                It seems very strange that more people wouldn't want this field, so I do feel that I must be overlooking something really obvious!

                Comment

                • SteveDev
                  Junior Member
                  • Oct 2018
                  • 11

                  #9
                  Originally posted by newbie99 View Post

                  Firstly, apologies for the slow response!

                  I don't believe that works unfortunately as although you can get a lot of info, it doesn't allow you to get the Runner Name field.

                  It seems very strange that more people wouldn't want this field, so I do feel that I must be overlooking something really obvious!
                  Ah yes, sorry. It does appear that the only way is to get all runners using listMarketCatalogue, then filter through to find the runner you're after. Not as clean as it could be, but it does get the job done.

                  Unless anyone else has any suggestions?

                  Comment

                  Working...
                  X