Get Competition

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Daggg
    Junior Member
    • Nov 2013
    • 7

    #1

    Get Competition

    Full Competitions for Soccer:
    Code:
    sportsApingRequest($appkey, $SesToken, 'listCompetitions', '{"filter":{"eventTypeIds":["1"]}}');
    1. Where is English Soccer? This API-NG using another DataBase then API 5 (or 6)?

    2. In Competitions list, I've got next:
    Code:
    Copetition ID - 7
    Copetition name - Austrian Bundesliga
    Copetition Region - AUT
    What filter (or command) I should use to see all details of that Competition?

    3. There are no eventTypeIds No. 7 any more (Horse Racing)? Or simple can't be requseted through Competitions?
    Last edited by Daggg; 05-12-2013, 02:59 PM.
  • betdynamics
    Junior Member
    • Sep 2010
    • 534

    #2
    It is not clear what you are trying to achieve.

    If you just want to load the markets, then use listMarketCatalogue instead.

    Comment

    • Daggg
      Junior Member
      • Nov 2013
      • 7

      #3
      Originally posted by betdynamics View Post
      It is not clear what you are trying to achieve.

      If you just want to load the markets, then use listMarketCatalogue instead.
      Thanks betdynamics.

      This works:
      Code:
      $filter = '{"filter":{}}'; //-- nothing; empty, null
      [{"jsonrpc": "2.0", "method": "SportsAPING/v1.0/listEventTypes", $filter);
      [b]All Active Event Types[/b]
      Event ID    Event Type
      --------    --------
       1	    Soccer
       2 	    Tennis
       3 	    Golf
      * * *
      This too:
      Code:
      $filter = '{"filter":{[1]}}';
      [{"jsonrpc": "2.0", "method": "SportsAPING/v1.0/listCompetitions", $filter);
      [b]Soccer[/b]
      Compet. ID    Compet. name                           Co. Region
      ----------    -----------------------------------    ----------
       803237       Argentinian Primera B                  ARG
       3765124      Argentinian Primera B Metropolitana    ARG
       3            Argentinian Torneo Inicial	     ARG
      * * *
      What is the way to explore Argentinian Primera B (ID=803237)? Using GET in previous API, it was easy. Here, I can't do it.
      This (without filter or parameters) doesn't work at all.
      Code:
      $filter = '{"filter":{[]}}';
      [{"jsonrpc": "2.0", "method": "SportsAPING/v1.0/listMarketCatalogue", $filter);
      Maybe some parameters are required? Or filter let's say... impossible to be seen in documentation. Examples are to advanced... one page with exploring all fundamental sections (events, competitions, markets...) will be very helpful.

      Comment

      • betdynamics
        Junior Member
        • Sep 2010
        • 534

        #4
        You can set a competition id in the filter.

        I'm not 100% sure of the JSON syntax but try something like:

        Code:
        $filter = '{"filter":{"competitionIds":["803237"]}}';
        [{"jsonrpc": "2.0", "method": "SportsAPING/v1.0/listMarketCatalogue", $filter);

        Comment

        • gus
          Senior Member
          • Jan 2009
          • 134

          #5
          for that specific query, to list matches in the Argententinian Primera B, i'd use:

          listEvents

          with the filter

          {"filter":{"competitionIds":[803237]}}

          so, using REST, the call is:

          Code:
          https://api.betfair.com/exchange/betting/rest/v1.0/listEvents/
          
          {"filter":{"competitionIds":[803237]}}
          dunno about RPC, but i guess it's similar.

          similary, to list matches in the English Barcays Premier League the call would be:

          Code:
          https://api.betfair.com/exchange/betting/rest/v1.0/listEvents/
          
          {"filter":{"competitionIds":[31]}}
          Last edited by gus; 08-12-2013, 01:51 AM. Reason: forgot some code

          Comment

          • Daggg
            Junior Member
            • Nov 2013
            • 7

            #6
            Thank you mates.
            betdynamics *** listMarketCatalogue doesn't work.
            Guss' examples works!
            Full code from PHP sample is:
            Code:
            /*	//---- Could be useful
            	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
            	curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);  
            */
            	$ch = curl_init();
            	curl_setopt($ch, CURLOPT_URL, "https://api.betfair.com/exchange/betting/json-rpc/v1");
            	curl_setopt($ch, CURLOPT_POST, 1);
            	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
            	curl_setopt($ch, CURLOPT_HTTPHEADER, array (
            		'X-Application: '.$dagAppKey,
            		'X-Authentication: '.$dagSesTok,
            		'Accept: application/json',
            		'Content-Type: application/json'
            		));
            	$postData = '[{ "jsonrpc": "2.0", "method": "SportsAPING/v1.0/' . $operation . '", "params" :' . $params . ', "id": 1}]';
            	curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
            //	debug('Post Data: '.$postData);
            	$response = json_decode(curl_exec($ch));
            //	debug('Response: '.json_encode($response));
            	curl_close($ch);
            But this line I am seeing the first time (maybe it can solve some problems in the future):
            Code:
            https://api.betfair.com/exchange/betting/rest/v1.0/listEvents/
            Probably should replace line curl_setopt($ch, CURLOPT_URL, "***

            Last parameter "id":1 in the var $postData means what exactly?

            Also, Ive notice when params has line marketCountries as:
            Code:
            $pid = 2;
            #cod = 'GB';
            $params = '{"filter":{
            	"eventTypeIds":["'.$pid.'"]
            	,"marketCountries":["'.$cod.'"]
            response are "eating" the events with older dates then today. In Visualiser it is not the case. Or I am wrong?

            Comment

            • gus
              Senior Member
              • Jan 2009
              • 134

              #7
              well , whether you replace the line:

              Code:
              curl_setopt($ch, CURLOPT_URL, "https://api.betfair.com/exchange/betting/json-rpc/v1");
              with

              Code:
              https://api.betfair.com/exchange/betting/rest/v1.0/listEvents/
              would really depend upon whether you intend to use REST or RPC throughout your application.

              I chose REST, for no other reason than that looked easier to understand, so I use REST throughout my app.

              As for the "id" field, i've never really understood what that's for ... perhaps it's supposed to be incremented with each query so that you can identify a particular query?

              Dunno, but leaving it out doesn't seem to cause any problems (when using REST)

              Comment

              Working...
              X