0

I am trying to communicate to a WebAPI via MSXML, but whenever I try to request a response, my error-handle is called and it shows "Statuscode 429: Too many requests". When I paste the URL which I call into my browser, I get the correct and expected response immediately. I do not understand where the problem is lying. Is my guess correct, that MSXML.HTTP-requests are send from a centralized Microsoft server? This would mean, that everybody, who is using this function to call the same API as I did, is stacking requests, leading to the API blocking the Microsoft-Sever-IP for too many requests. If so, can I somehow define the IP of a MSXML.HTTP-request?

Code used for the API-Call:

    Dim urlAPISteam As String
    Dim parametersSteam As String
    Dim url As String
    Dim clientID As String
    
    'http://steamcommunity.com/inventory/<PROFILEID>/730/2?l=english&count=##
    
    'API Request Steam
    clientID = 76561197960361544
    urlAPISteam = "https://steamcommunity.com/inventory/"
    parametersSteam = clientID & "/730/2?l=english&count=1"
    url = urlAPISteam & parametersSteam
    
    
    With CreateObject("MSXML2.XMLHTTP.6.0")
        .Open "Get", url, False
        .send

        'Error Handle
        If .Status <> 200 Then
            MsgBox "Statuscode: " & .Status & " Message: " & .responseText
            Exit Sub
        End If

        Dim response As Collection
        Set response = JsonConverter.ParseJson(.responseText)

    End With
    

I found the proxy function, but is this the only way to go? That might kill my project.

I already checked:

  • I got an APIkey but it is not needed for this Request (Same issue with the key applied)
  • What exactly is the use case for this code? How is it being called and how often/frequently? – Tim Williams Apr 10 '23 at 21:51
  • Related (but not answered) https://stackoverflow.com/questions/74999554/steam-get-inventory-of-user-returns-429-after-few-requests Seems like this might be intentional. – Tim Williams Apr 10 '23 at 21:55
  • The code is used to get a JSON which includes information about items in an inventory of a profile on the gaming platform steam. – n3tw4rri0r Apr 10 '23 at 22:44
  • That's a functional description which I can gather from looking at the code - what you don't tell us is how often it gets called per (eg) minute/day/week. It's possible you're hitting some kind of throttle on the number of requests. – Tim Williams Apr 10 '23 at 23:49
  • I call it once. Thats it. Maximum once per hour. The API itself is limited to 100.000 calls per day and like I said: I don't get near to any throttling limits: when i paste the URL in my browser it works perfectly fine. My question now is: Is the MSXML-request send from my own IP or from some Microsoft server? – n3tw4rri0r Apr 11 '23 at 00:42
  • MSXML request comes from your own PC (or if you're behind a firewall I guess it might appear to have come from that...) – Tim Williams Apr 11 '23 at 05:20

0 Answers0