LibraryOfCongress / api.congress.gov

congress.gov API
605 stars 38 forks source link

Requests blocked from hosting environment - 403 #209

Closed bahua closed 5 days ago

bahua commented 3 months ago

I am unable to access the API anymore from hosting VPSes I have running on Linode and Digital Ocean. It was working fine for months, but now, when I try to access the API from these hosts, I get a 403 forbidden code. When I attempt to access it from home, or from the office, the requests work fine. Could you please unblock my requests? Please see the attached image. The first host(engljk) is my work machine. The second(enhasa) is a VPS on Linode. This looks the same for any DO or Linode VPS I'm using.

image

mnewatloc commented 3 months ago

That image seems to show that your API key is missing.

bahua commented 3 months ago

That image seems to show that your API key is missing.

Yes, I am not complaining about that output. I am just pointing out that I am getting a 403 when I try to connect from Linode.

Gmanicus commented 3 months ago

Right, that 403 (including the HTML 403 response) is likely being returned because it doesn't see your API key.

If you've already gotten your API key (here if you need one: https://api.congress.gov/sign-up/), do this instead: curl https://api.congress.gov/v3/member?api_key=YOUR_API_KEY

The API is expecting to see the key as part of the request URL query.

bahua commented 3 months ago

Right, that 403 (including the HTML 403 response) is likely being returned because it doesn't see your API key.

No, it gives me a 403 regardless. I didn't paste in the whole request because it's irrelevant and would just take up space. On the host where it asks for the API key, requests wherein I supply it in the headers work fine. On the Linode hosts, it shows a 403 regardless.

rbram commented 3 months ago

Hello. Thanks for your feedback. We are investigating this.

bahua commented 5 days ago

If the issue is completed, could you please update with the resolution details?

apreiter18 commented 5 days ago

Hi @bahua - apologies, we wanted to follow up with you and see if this issue was still occurring for you. Accidentally hit the "close" button.

bahua commented 5 days ago

Because of this issue I actually changed hosting to a new provider, from which I do not get this error. So I am no longer in a position to troubleshoot this issue without spending money. If you know someone who gets their hosting from Linode, you can ask them to just do a curl or a wget against the Congress endpoint. If they get the "API KEY MISSING" message, then the problem is resolved.

apreiter18 commented 5 days ago

Thank you - we were unable to replicate this issue, which is why I wanted to ask. Are you comfortable with us closing this issue and reopening this if the issue presents itself in the future?

bahua commented 5 days ago

Absent a way to easily verify one way or the other, that seems the most prudent course of action.

Thank you for your help with this.