Problems suddenly obtaining data from the API

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • monkeymagix
    Junior Member
    • Jul 2010
    • 105

    #1

    Problems suddenly obtaining data from the API

    Hi

    Over the last few days I have suddenly stopped being able to obtain data from the API such as AccountFunds (liability / balance) and market prices.

    This was working a few days ago and I haven't done anything. I can still login to the website AND login to the API with both JSON objects (using C# BOT).

    Here is an example of one of my requests to get market data that just returns a null response.

    IN SaveGlobalMarkets;

    EndPoint = https://api.betfair.com/exchange/betting/json-rpc/v1/;
    Calling: SportsAPING/v1.0/listMarketCatalogue With args: {"filter":{"eventTypeIds":["7"],"turnInPlayEnabled":true,"marketCountries":["GB"],"marketTypeCodes":["WIN","PLACE"],"marketStartTime":{"from":"2015-07-28T15:15:47.0219949+01:00","to":"2015-07-29T00:00:00+01:00"}},"marketProjection":["COMPETITION","RUNNER_DESCRIPTION","EVENT","EVENT_ TYPE","MARKET_START_TIME","RUNNER_METADATA"],"sort":"FIRST_TO_START","maxResults":"200","local e":null};

    try and get response;

    Got Response: null;

    EXCEPTION Error occurred at: 28/07/2015 15:15:47; An error occurred running RunPriceChecks - Country: GB; Object reference not set to an instance of an object. Error Info: at Api_ng_sample_code.JsonRpcClient.Invoke[T](String method, IDictionary`2 args) in ...\BetfairBOT2\Api-ng-sample-code\JsonRpcClient.cs:line 251

    at Api_ng_sample_code.JsonRpcClient.listMarketCatalog ue(MarketFilter marketFilter, ISet`1 marketProjections, MarketSort marketSort, String maxResult, String locale) in ...\BetfairBOT2\Api-ng-sample-code\JsonRpcClient.cs:line 121

    RunPriceChecks RETURNS False;

    The error is on this line in the JSON RPC class


    Code:
    this.HelperLib.LogMsg("Got Response: " + JsonConvert.Serialize<JsonResponse<T>>(jsonResponse));
    
    if (jsonResponse.HasError)
    {
        this.HelperLib.LogMsg("Got an Error = " + jsonResponse.Error.ToString());
    
        throw ReconstituteException(jsonResponse.Error);
    }
    else
    {
        return jsonResponse.Result;
    }
    I have contacted BDP but heard nothing back so far.

    I don't know if it is something I have done or the API or something else.

    Thanks

    Rob
  • joeyjoeuk
    Junior Member
    • Jul 2011
    • 11

    #2
    Have you updated your HTTP headers for the 'Expect: 100 changes' that came in on Monday? See: http://forum.bdp.betfair.com/showthread.php?t=2901

    Comment

    • monkeymagix
      Junior Member
      • Jul 2010
      • 105

      #3
      Answer

      The answer, not that I had any clue until BDP told me was their change to turn servicePoint.Expect100Continue = false; So that requests and post data were sent in two batches in case of a forbidden or whatever status code they may have returned inbetween/

      The code was just

      Code:
      var uri = new Uri(EndPoint);
      var request = CreateWebRequest(uri);
      ServicePoint servicePoint = ServicePointManager.FindServicePoint(uri);
      
      //should happen only once for each URL
      servicePoint.Expect100Continue = false;
      
      
      using (Stream stream = request.GetRequestStream())
      using (StreamWriter writer = new StreamWriter(stream, Encoding.UTF8))
      {
      	var call = new JsonRequest { Method = method, Id = 1, Params = args };
      	JsonConvert.Export(call, writer);
      }
      Hope this helps!

      Comment

      Working...
      X