Announcement

Collapse
No announcement yet.

Is the historical api documentation?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    Is the historical api documentation?


    Is the historic data API docs up to date?

    I am trying the example heres: https://historicdata.betfair.com/#/apidocs

    The first example works, so I know I'm setting the SSOID correctly.

    But if I try the DownloadListOfFiles example:

    curl -X POST http://historicdata.betfair.com/api/DownloadListOfFiles -H 'content-type: application/json' -H 'ssoid: YOUR_TOKEN_HERE' -d '{ "sport":"Horse Racing", "plan":"Basic Plan", "fromDay" : 1, "fromMonth": 3, "fromYear" : 2017, "toDay": 31, "toMonth" : 3, "toYear": 2017, "eventId": null, "eventName": null, "marketTypesCollection": [ "WIN", "PLACE" ], "countriesCollection" : [ "GB", "IE" ], "fileTypeCollection" : [ "M"] }'

    I get this error:

    <html><head><title>Object moved</title></head><body> <h2>Object moved to <a href="https://historicdata.betfair.com/home/ngErrorRedirect">here</a>.</h2> </body></html>

    I Python example code would be greatly appreciated too!

    #2
    Hi Bernard,

    Have you purchased Horse Racing Basic for March 2017?
    (You need to purchase of all the months & plans defined in your filter,other wise you will get a error)

    I don't think there are any python examples but there is a Postman document online that allows you to switch to python examples:
    https://documenter.getpostman.com/view/2487254/RWaGVqZ9

    I hope that helps, Cheers

    Comment


      #3
      The API is a bit tricky to use, any errors seem to be very cryptic, here is an example using lightweight:

      https://github.com/liampauling/betfa...istoricdata.py

      Comment


        #4
        Thanks Mike. You were right. I had to purchase the data first. A shame the documentation didn't tell me, even though the data is free!

        Originally posted by MikeBateman View Post
        Hi Bernard,

        Have you purchased Horse Racing Basic for March 2017?
        (You need to purchase of all the months & plans defined in your filter,other wise you will get a error)

        I don't think there are any python examples but there is a Postman document online that allows you to switch to python examples:
        https://documenter.getpostman.com/view/2487254/RWaGVqZ9

        I hope that helps, Cheers

        Comment


          #5
          Thanks for the tip Liam. Your repository is very impressive!

          Originally posted by LiamP View Post
          The API is a bit tricky to use, any errors seem to be very cryptic, here is an example using lightweight:

          https://github.com/liampauling/betfa...istoricdata.py

          Comment


            #6
            I'm having a similar issue. When I basic CLI Curl request to an example endpoint I get an expected response, when I try it through an app using Guzzle as the HTTP client however, I get the ngErrorRedirect?

            Code:
            curl -X GET https://historicdata.betfair.com/api/GetMyData -H 'ssoid: MY_TOKEN'
            returns

            Code:
            [{"sport":"Horse Racing","plan":"Basic Plan","forDate":"2018-01-01T00:00:00","purchaseItemId":20136},{"sport":"Horse Racing","plan":"Basic Plan","forDate":"2018-02-01T00:00:00","purchaseItemId":20136},{"sport":"Horse Racing","plan":"Basic Plan","forDate":"2018-03-01T00:00:00","purchaseItemId":20136},{"sport":"Horse Racing","plan":"Basic Plan","forDate":"2018-04-01T00:00:00","purchaseItemId":20136},{"sport":"Horse Racing","plan":"Basic Plan","forDate":"2018-05-01T00:00:00","purchaseItemId":20136},{"sport":"Horse Racing","plan":"Basic Plan","forDate":"2018-06-01T00:00:00","purchaseItemId":20136},{"sport":"Horse Racing","plan":"Basic Plan","forDate":"2018-07-01T00:00:00","purchaseItemId":20136}]
            Through Guzzle however I make exactly the same request and I get:

            Code:
            <!DOCTYPE html>
            
            
            
            
            <html>
            
            <head>
            
                <meta name="viewport" content="width=device-width" />
            
                <title>ngErrorRedirect</title>
            
            </head>
            
            <body>
            
                <div> 
            
                    Error
            
                </div>
            
            </body>
            
            </html>
            
            NULL
            (In case you'd like the code I'm using to run this, i've simplified it but dependency injection is implemented for the session token retrieval, I have checked that the token IS being passed correctly

            Code:
            class HistoricDataService
            {
            
                const BETFAIR_URL = 'https://historicdata.betfair.com/api/';
            
                private $client;
            
                public $sessionToken;
            
                function __construct()
                {
                    $this->client = new Client(['base_uri' => self::BETFAIR_URL, 'headers' => $this->getDefaultHeaders()]); //GuzzleHttp\Client
                    $this->sessionToken = \PeterColes\Betfair\Api\Auth::$sessionToken;
                }
            
            
                public function get($method)
                {
                    $response = $this->client->request('get', $method, []);
                    print_r((string) $response->getBody());
                }
            
                private function getDefaultHeaders()
                {
                    return [
                            'content-type' => 'application/json',
                            'ssoid' => $this->sessionToken,
                        ];
                }
            
            }
            
            $historicDataService = new HistoricDataService();
            $historicDataService->get('GetMyData');

            Comment


              #7
              Hello, I need some help. I have downloaded a Basic free historical data file for greyhounds October. During downloading, it said Failed network error. Scanned internet and it said it was a zip file. Installed Winzip. Clicked on data file downloading and right clicked and pressed Save Link as. Files were moved to a folder in Downloads. I opened that and went to a folder saying xds. I opened that to a historical folder. I opened that to a Basic folder. I opened that to 15 numbered folders. I opened that to 20 plus documents. Tried to open one with Winzip and it says Unable to find software to open this. Any help would be great and if you could help me by explaining it as if you were talking to a child(actually, they would probably able to sort it) Cheers.

              Comment

              Working...
              X