listCompetitions (again ....)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gus
    Senior Member
    • Jan 2009
    • 134

    #1

    listCompetitions (again ....)

    In my Life's Mission of trying to rationalise the Results from listCompetitions (particularly football) into some sort of usable Tree Menu I've got to the stage where I'm listing the various football competitions by competitionRegion, via a call to listCompetitions as below:

    listCompetitions/{"filter":{"eventTypeIds":["1"],"marketCountries":["UA","SI","IS","GB","JP","KR","IE","NO","SE","FI", "B
    R","SK","CH","RU","PL","CZ","DK","DE","RO","BG","A T","HU","BE","NL","FR","IT","TR","ES","CS","GR","P T","HR","KZ","IN","A
    Z","AM","GE","IL","LV","LT","SA","CR","JM","VN","H K","JO","DZ","QA","EE","PE","AR","PY","ZA","CL","E C","MX","US","SG","T
    H","AE","BY","IR","CO","CA","MK","UY","MV","KW","M Y","TT","CY","MD"]}}


    I'm then sorting the competitions by country, so that I can make Menu Nodes for each country (by converting the 3 character competitionRegion into the "iso" full name) so that when a User clicks on the Country they'll get its associated Competitions.

    That works fine BUT, I keep getting 'rogue' competitions, e.g. for UK ( "GBR" ) competitions I get:


    GBR: {"competitionRegion":"GBR","marketCount":12,"compe tition":{"id":"20351","name":"NIFL Premiership"}}
    GBR: {"competitionRegion":"GBR","marketCount":961,"comp etition":{"id":"31","name":"Barclays Premier League"}}
    GBR: {"competitionRegion":"GBR","marketCount":942,"comp etition":{"id":"35","name":"League One"}}
    GBR: {"competitionRegion":"GBR","marketCount":1478,"com petition":{"id":"33","name":"The Championship"}}
    GBR: {"competitionRegion":"GBR","marketCount":124,"comp etition":{"id":"39","name":"Conference Premier"}}
    GBR: {"competitionRegion":"GBR","marketCount":942,"comp etition":{"id":"37","name":"League Two"}}
    GBR: {"competitionRegion":"GBR","marketCount":106,"comp etition":{"id":"843454","name":"Uruguayan Primera"}}
    GBR: {"competitionRegion":"GBR","marketCount":38,"compe tition":{"id":"43","name":"Conference South"}}
    GBR: {"competitionRegion":"GBR","marketCount":42,"compe tition":{"id":"41","name":"Conference North"}}
    GBR: {"competitionRegion":"GBR","marketCount":36,"compe tition":{"id":"409743","name":"Scottish Cup"}}
    GBR: {"competitionRegion":"GBR","marketCount":11,"compe tition":{"id":"111","name":"Scottish League Two"}}
    GBR: {"competitionRegion":"GBR","marketCount":12,"compe tition":{"id":"109","name":"Scottish League One"}}
    GBR: {"competitionRegion":"GBR","marketCount":61,"compe tition":{"id":"107","name":"Scottish Championship"}}
    GBR: {"competitionRegion":"GBR","marketCount":313,"comp etition":{"id":"105","name":"Scottish Premiership"}}
    GBR: {"competitionRegion":"GBR","marketCount":20,"compe tition":{"id":"822377","name":"Superliga Femenina"}}
    GBR: {"competitionRegion":"GBR","marketCount":40,"compe tition":{"id":"3085778","name":"English Womens Super League"}}
    GBR: {"competitionRegion":"GBR","marketCount":160,"comp etition":{"id":"860010","name":"Ukrainian Reserve League"}}
    GBR: {"competitionRegion":"GBR","marketCount":30,"compe tition":{"id":"872215","name":"Ukrainian Persha Liga"}}
    GBR: {"competitionRegion":"GBR","marketCount":37,"compe tition":{"id":"252549","name":"Welsh Premier League"}}
    GBR: {"competitionRegion":"GBR","marketCount":3,"compet ition":{"id":"2608550","name":"Specials"}}
    GBR: {"competitionRegion":"GBR","marketCount":29,"compe tition":{"id":"67646","name":"World Cup 2014 Qualifiers"}}
    GBR: {"competitionRegion":"GBR","marketCount":1,"compet ition":{"id":"30558","name":"English FA Cup"}}
    GBR: {"competitionRegion":"GBR","marketCount":1,"compet ition":{"id":"2134","name":"Capital One Cup"}}
    GBR: {"competitionRegion":"GBR","marketCount":2,"compet ition":{"id":"986846","name":"Ramsdens Cup"}}
    GBR: {"competitionRegion":"GBR","marketCount":107,"comp etition":{"id":"228","name":"UEFA Champions League"}}
    GBR: {"competitionRegion":"GBR","marketCount":209,"comp etition":{"id":"2129602","name":"Professional Development League"
    }}

    now I've got no grudge against Uruguay, the Ukraine, or even the Superliga Femenina, but, as we say on ChitChat: WTF?

    I should probably add that the list of marketCountries that are sent in the query:

    listCompetitions/{"filter":{"eventTypeIds":["1"],"marketCountries":["UA","SI","IS","GB","JP","KR","IE","NO","SE","FI", "B
    R","SK","CH","RU","PL","CZ","DK","DE","RO","BG","A T","HU","BE","NL","FR","IT","TR","ES","CS","GR","P T","HR","CO","KZ","I
    N","AZ","AM","GE","IL","LV","LT","SA","CR","JM","V N","HK","JO","DZ","QA","EE","PE","AR","PY","ZA","C L","EC","MX","US","S
    G","TH","AE","BY","IR","CA","MK","UY","MV","KW","M Y","TT","CY","MD"]}}

    is derived from an earlier call to get the countries that have soccer competitions:

    listCountries/{"filter":{"eventTypeIds":["1"]}}

    and, as can be seen, the countryCode(s) returned by the listCountries request are 2 character iso codes. Quite confusing since listCompetitions returns 3 letter iso codes for competitionRegion !
    Last edited by gus; 12-09-2013, 03:05 PM. Reason: added explanation of how the marketCountries are derived
  • BetfairDeveloperProgram
    Administrator
    • Oct 2008
    • 679

    #2
    Hi gus,

    The rogue competitions belonging to Uruguay and the Ukraine have now been corrected.

    Thanks for pointing these out.

    Neil

    Comment

    • gus
      Senior Member
      • Jan 2009
      • 134

      #3
      Originally posted by Betfair Developers Program View Post
      Hi gus,

      The rogue competitions belonging to Uruguay and the Ukraine have now been corrected.

      Thanks for pointing these out.

      Neil
      Yep. That's it sorted ... i rather regret the passing of the Superliga Femenina ... quite catchy

      Thanks.

      Comment

      • kawafan
        Junior Member
        • May 2011
        • 33

        #4
        Hi

        Hi dear ,
        Have you manged to get a tree view type structure from API_NG markets , Could you share your code if its in .NET or java.
        ty.

        Comment

        • gus
          Senior Member
          • Jan 2009
          • 134

          #5
          Well, I don't know what I've done to inspire such affection!

          But, yes I have got a more or less working API_NG Tree menu, tho it's still a bit buggy.

          I've put a couple of pics here:


          http://www.flickr.com/photos/92492144@N08/9833349294/

          http://www.flickr.com/photos/92492144@N08/9833369655/

          Some possible bugs are that, although I can use the menu to navigate, via Soccer > Country > Competition > Event to all of the required UK and French matches over my chosen period of time (e.g. 2 days), the same routine doesn't always seem to work for some other Countries, e.g earlier today it wouldn't work for Argentina, but, having just checked, now it does!

          Don't know whether that was me or the API ... possibly it was just timezones.

          As for posting the code, (it's Java) I'd be quite happy do, but, like most of my code it's kinda messy, so I'll try to tidy it up a bit this weekend, and if it looks ok after that I'll post a link to it sometime next week.

          Comment

          Working...
          X