Aplication Key

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • denimen.
    Junior Member
    • Feb 2013
    • 14

    #1

    Aplication Key

    Greetings,

    I've recently got the Aplication Key for usage of new Betfair Api...
    _________________________________________________
    "How to Access

    Please use the following Application Key to access the service

    something like this: dfdFEEFDffmefke"
    _________________________________________________

    ok, i've been using soap to get the markets i need but on 82 product ID as a free user..

    PHP Code:
    $global= new SoapClient("https://api.betfair.com/global/v3/BFGlobalService.wsdl");
    ######################################## LOGIN
    $aLogin=$global->login(array('request'=>array('username'=>'denimen'
                               
    ,'password'=>$password
                               
    ,'productId'=>82
                               
    ,'vendorSoftwareId'=>0
                               
    ,'locationId'=>0
                               
    ,'ipAddress'=>$ip)));

    $token=$aLogin->Result->header->sessionToken
    When i add 'X-Aplication'=>$appKey I do get the session token, but this 82 to is still confusing to me since i don't know am i still treated as a free user???

    Thanks, Denis
  • AlgoTrader
    Junior Member
    • Mar 2012
    • 243

    #2
    You are using login from the old SOAP API6. Why things should be different?
    New API has no login method yet
    Betfair Bots Made Easy

    Comment

    • denimen.
      Junior Member
      • Feb 2013
      • 14

      #3
      Ok, Im reading this new documentation on new API and i get some errors when trying to get the json file..

      PHP Code:
      curl_setopt_array($curl, array(
          
      CURLOPT_SSL_VERIFYPEER => FALSE,
          
      CURLOPT_RETURNTRANSFER => 1,
          
      CURLOPT_URL => $url,
          
      CURLOPT_POST => 1,
          
      CURLOPT_POSTFIELDS => array(
               
      "X-Application" => $appKey
              
      ,"X-Authentication" => $token
              
      ,"Content-type" => "application/json"
          
      )
      )); 
      And I get this error: {"detail":{},"faultcode":"Client","faultstring":"D SC-0011"}

      Does anyone know what these error code means.?? or do i need to parse something else in the header?

      Comment

      • PT_PT
        Junior Member
        • Nov 2012
        • 17

        #4
        DSC-0011 means that your request's content-type is invalid.
        I guess that the values you sent with CURLOPT_POSTFIELDS are supposed to be sent with CURLOPT_HEADER

        Comment

        • denimen.
          Junior Member
          • Feb 2013
          • 14

          #5
          Ok, I'm kind of new to cURL and php in general..

          I need some help on this one:

          To get the list of competitions for soccer how do i call the link..for eg:


          PHP Code:
          $url="https://beta-api.betfair.com/rest/v1.0/listCompetitions";

          $curl curl_init();
          curl_setopt_array($curl, array(
              
          CURLOPT_RETURNTRANSFER => 1,
              
          CURLOPT_URL => $url,
              
          CURLOPT_POST => 1,
              
          CURLOPT_HEADER =>1,
             
             
              
              
          CURLOPT_HTTPHEADER => array(
                   
          "X-Application" => $appKey
                  
          ,"X-Authentication" => $token
                  
          ,"Content-type" => 'application/json'
              
          )
          ));

          $file curl_exec($curl); 
          This gets me the certificate error, but when i use CURLOPT_SSL_VERIFYPEE=> FALSE i get other error stating

          HTTP/1.1 404 Not Found Date: Mon, 18 Feb 2013 11:39:06 GMT Cache-Control: no-cache Content-Type: application/json Content-Length: 59 nnCoection: close {"detail":{},"faultcode":"Client","faultstring":"D SC-0021"}

          All i need is a kick start help to make one call that works so i can move on!!

          Thanks, Denis

          Comment

          • PT_PT
            Junior Member
            • Nov 2012
            • 17

            #6
            It seems to be a bug in API.
            replace your url with this one:
            $url="https://beta-api.betfair.com/rest/v1.0/listCompetitions/";

            if you add the "/" at the end of the url, it will work, otherwise it will return a 404

            Works:
            Code:
            "curl [url]https://beta-api.betfair.com/rest/v1.0/listCompetitions/[/url]  -k -H"X-Application: xxx" -H"X-Authentication: xxx" -H"Content-type: application/json" --data '{"filter":{ "eventTypeIds" : [1] }}, "id": 1}'"
            Not working:
            Code:
            "curl [url]https://beta-api.betfair.com/rest/v1.0/listCompetitions[/url] -k -H"X-Application: xxx" -H"X-Authentication: xxx" -H"Content-type: application/json"  --data '{"filter":{ "eventTypeIds" : [1] }}, "id": 1}'"

            Comment

            Working...
            X