What has changed since March?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Arbu
    Junior Member
    • Nov 2012
    • 16

    #1

    What has changed since March?

    I have code which I obtained in March this year for using the API-NG. But at some point in the intervening period it has stopped working. Is there anything which has changed since then and which leaps out as immediately obvious as an explanation of why my code no longer works? If not then perhaps I'd better start again from scratch.

    I get an error at request.GetRequestStream - "Error occurred: 5 - The underlying connection was closed: An unexpected error occurred on a receive."

    Thanks.

    Code:
      Function SendRequest(ByVal Data) As String
            On Error GoTo ErrorHandler
            'Code is from here: http://www.betfairprotrader.co.uk/. Has started stalling when I try GetResponse as of 2 April.
    
            Dim request As WebRequest = WebRequest.Create("https://api-ng.betstores.com/betting/betfair/services/api.betfair.com/exchange/betting/json-rpc/v1")
            request.Method = "POST"
    
            Dim byteArray As Byte() = System.Text.Encoding.UTF8.GetBytes(Data)
            request.ContentType = "application/json"
            request.ContentLength = byteArray.Length
    
            request.Headers.Add("X-Application: " & "***********")      'id I got for "betfair checker".
            request.Headers.Add("X-Authentication: " & ssoid)
    
            Dim dataStream As System.IO.Stream = request.GetRequestStream()
            dataStream.Write(byteArray, 0, byteArray.Length)
            dataStream.Close()
            Dim response As WebResponse = request.GetResponse()
            Debug.Print(CType(response, HttpWebResponse).StatusDescription)
            dataStream = response.GetResponseStream()
            Dim reader As New System.IO.StreamReader(dataStream)
            Dim responseFromServer As String = reader.ReadToEnd()
            reader.Close()
            dataStream.Close()
            response.Close()
    
            Return responseFromServer
    
    ErrorHandler:
            HandleError()
        End Function
    Last edited by Arbu; 30-09-2014, 04:01 PM.
  • betdynamics
    Junior Member
    • Sep 2010
    • 534

    #2
    The URL that you are using is incorrect.

    See https://api.developer.betfair.com/se...ni/Betting+API for the correct endpoints to use.

    Comment

    • Arbu
      Junior Member
      • Nov 2012
      • 16

      #3
      Originally posted by betdynamics View Post
      The URL that you are using is incorrect.

      See https://api.developer.betfair.com/se...ni/Betting+API for the correct endpoints to use.
      Thanks. No error now. But I get no data returned in response to my request. My request is

      "{""jsonrpc"": ""2.0"", ""method"":""SportsAPING/v1.0/listMarketBook"", ""params"": {""marketIds"":[" & mIDs & "], ""priceProjection"" :{""priceData"": [""EX_BEST_OFFERS""]}}, ""id"": 1}"

      mIDs being 115714884,the market ID for the 6:50pm horserace at Wolverhampton.

      Any further thoughts?

      Comment

      • Arbu
        Junior Member
        • Nov 2012
        • 16

        #4
        Originally posted by Arbu View Post
        Thanks. No error now. But I get no data returned in response to my request. My request is

        "{""jsonrpc"": ""2.0"", ""method"":""SportsAPING/v1.0/listMarketBook"", ""params"": {""marketIds"":[" & mIDs & "], ""priceProjection"" :{""priceData"": [""EX_BEST_OFFERS""]}}, ""id"": 1}"

        mIDs being 115714884,the market ID for the 6:50pm horserace at Wolverhampton.

        Any further thoughts?
        Ah, I THINK I was using the old API to get the market ID and then trying to get the prices using that with API-NG. If I understand correctly the marketIDs for the API-NG have "1." in front of them. So I just need to make sure I'm getting the market IDs with the API-NG and ListMarketCatalogue.

        Comment

        • betdynamics
          Junior Member
          • Sep 2010
          • 534

          #5
          Markets are prefixed with "1." for UK exchange and "2." for AUS exchange.

          Comment

          Working...
          X