newbie question: How do I get a list of all football matches in GB ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Zaytoon
    Junior Member
    • Mar 2014
    • 4

    #1

    newbie question: How do I get a list of all football matches in GB ?

    Hi,

    I've been playing about with the new API and am trying to work out how to get a list of all UK football matches. I want to eventually be able to do my own football bets this way.

    I've tried the API-NG Visualiser and am not having much success. I only want actual Football matches and not events like "Winner/Top Goalscorer 2013/14" etc.

    Is there a way to do this using QueryText in the MarketFilter ?

    thanks in advance
  • tkw141
    Junior Member
    • Nov 2013
    • 18

    #2
    Hi,

    You can't get a list of Football matches, only a list of markets to bet on such as Match Odds, etc.

    To create a filter for football, you first need to identify the competitions your interested in. Competitions are football leagues, cups, etc.

    In the Visualiser, select listCompetitions and fill in the form with the following:
    Event Type Ids = 1
    Countries = GB

    Click execute and this should give you a full list of UK leagues and cups. Make a note of the ID numbers of the ones you're interested in. For example, Barclays Premier League = 31, The Championship League = 33, etc

    Now select listMarketCatalogue and fill in the form with the following:
    Competition Ids = 31,33 (or whatever you want)
    Market Types = MATCH_ODDS (or whatever betting markets you want)
    Max Results = 100
    Additional Data = EVENT (you can select all or some of these if you want)


    Click Execute and this will give you a list of Match Odds betting markets for the upcoming games in the leagues you've chosen.

    Hope that helps,
    Tony

    Comment

    • Zaytoon
      Junior Member
      • Mar 2014
      • 4

      #3
      Hi Tony,

      Thanks for the answer it's appreciated, I can see the correct data now in the visualiser.

      I'm trying to do this in Java and have another question for you if you could help.

      I'm using the ApiNgOperations.listMarketCatalogue method from the given example code. I'm trying to replicate results I got in the visualiser but without success.

      This is what I have

      Code:
      Set<MarketProjection> marketProjections = new HashSet<MarketProjection>();
      marketProjections.add(MarketProjection.EVENT);
      
      Set<String> competitionIds = new HashSet<String>();
      competitionIds.add("31");
      
      Set<String> marketTypeCodes = new HashSet<String>();
      marketTypeCodes.add("MATCH_ODDS");
      
      MarketFilter marketFilter = new MarketFilter(); 
      marketFilter.setCompetitionIds(competitionIds);
      marketFilter.setMarketTypeCodes(marketTypeCodes);
      
      ApiNgOperations jsonOperations = ApiNgJsonRpcOperations.getInstance();
      List<MarketCatalogue> marketCatalogueResult = jsonOperations.listMarketCatalogue(marketFilter,                                                                                                                                                           
                                         marketProjections,                                                                                        
                                         MarketSort.MAXIMUM_AVAILABLE,                                                                                         
                                         maxResults,                                                                                          
                                         applicationKey,                                                                                         
                                         sessionToken);
      I'm not sure if you know Java much or are familiar with the example code but here's hoping

      I've tried the various MarketSort options but for some reason the Event type is not populated in any of the returned MarketCatalogue list.

      Any help is greatly appreciated.

      thanks
      Paul

      Comment

      • tkw141
        Junior Member
        • Nov 2013
        • 18

        #4
        Hi Paul,

        I do know Java but I haven't used it for this and haven't looked at the Java example before.

        As you are getting results I've assumed that you are setting the max results string to some number. Can't see it in your code.
        I can't see anything wrong in your code.

        I've just had a quick look at the Java source code and to me it doesn't look like marketProjection is being set in the params. Is this a mistake in the source code? Here's the code I was looking at:


        Code:
            public List<MarketCatalogue> listMarketCatalogue(MarketFilter filter, Set<MarketProjection> marketProjection,
                                                             MarketSort sort, String maxResult, String appKey, String ssoId) throws APINGException {
                Map<String, Object> params = new HashMap<String, Object>();
                params.put(LOCALE, locale);
                params.put(FILTER, filter);
                params.put(SORT, sort);
                params.put(MAX_RESULT, maxResult);
                String result = getInstance().makeRequest(ApiNgOperation.LISTMARKETCATALOGUE.getOperationName(), params, appKey, ssoId);
                if(ApiNGDemo.isDebug())
                    System.out.println("\nResponse: "+result);
        
                ListMarketCatalogueContainer container = JsonConverter.convertFromJson(result, ListMarketCatalogueContainer.class);
        
                if(container.getError() != null)
                    throw container.getError().getData().getAPINGException();
        
                return container.getResult();
        
            }
        As you can see, locale, filter, sort and maxResult are set, but not marketProjection.
        Hope that helps and doesn't send you off in the wrong direction.
        Perhaps someone who's using Java for APING can help here.

        Cheers,
        Tony

        Comment

        • Zaytoon
          Junior Member
          • Mar 2014
          • 4

          #5
          Thanks again Tony.

          I'd set my maxResult=200 so didn't max out the results.

          I think I'll have to delve into the example code a bit more and keep playing with this.

          thanks for your help.

          Comment

          • Zaytoon
            Junior Member
            • Mar 2014
            • 4

            #6
            Hi Tony,

            Just thought I'd let you know, you were spot on with the marketProjection not getting set in the demo code. I hadn't bothered looking at it as I assumed it was working ok.

            I have it all working now.

            Thanks again for the help!

            Comment

            Working...
            X