No announcement yet.

Accessing the API with Power Query

  • Filter
  • Time
  • Show
Clear All
new posts

  • Accessing the API with Power Query

    Hi, apologies for being a newbie.

    My racing model is completely built on PQ and VB. I have trying to integrate the Betfair as the exchange of choice.

    basically, this PQ code is failing as the response is that the error code is Json 32601 which is "method" is not available.

    I don't understand why, because the method works fine in python.

    PQ to Betfair API information is very very limited, so any any assistance is greatly appreciated. Thank in advance for any and all suggestions.

    formdata = "{""jsonrpc"": ""2.0"", ""method"": ""SportsAPING/v1.0/listEvents"", ""params"": {""filter"": {""eventTypeIds"": [""7""],""marketCountries"": [""AU""],""marketTypeCode"": [""WIN""]}}, ""id"": 1}" ,
    Source =
    Json.Document(Web.Contents("", [Headers=[#"X-Application"="myAppKey", #"X-Authenticaion"="mySessionToken", #"Content-Type"="application/json"], Content=Text.ToBinary(formdata)])),
    #"Converted to Table" = Record.ToTable(Source),
    Value = #"Converted to Table"{1}[Value],
    #"Converted to Table1" = Record.ToTable(Value)

    #"Converted to Table1"​

  • #2
    Hi JabbaJeff

    You are sending the request to the Account API endpoint -

    Please update the request to use the Betting API endpoint -

    See further docs via

    Kind Regards



    • #3
      Thanks Neil. Much appreciated.

      Sometimes, the most obvious answers just sit there staring at me :-).

      I am wondering though if anybody has used Excel Power Query to access the API.

      We know that X-Application & X-Authentication are required header information, PQ does not offer these as header optional parameters, so I have tried both, typing them manually and coding them directly into the Advanced Editor, both resulting in the same error of error code (400) - Bad call.

      I do remember seeing an article saying that someone has used Power Builder to access the API and that PQ was not successful.

      So I guess the question is if that statement is still true and if so, then I need to look at another solution to create a non-interactive login.

      Thanks for your help.