api.congress.gov icon indicating copy to clipboard operation
api.congress.gov copied to clipboard

Requests blocked from hosting environment - 403

Open bahua opened this issue 1 year ago • 5 comments

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

bahua avatar Mar 19 '24 15:03 bahua

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

mnewatloc avatar Mar 19 '24 19:03 mnewatloc

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.

bahua avatar Mar 19 '24 20:03 bahua

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.

Gmanicus avatar Mar 21 '24 01:03 Gmanicus

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.

bahua avatar Mar 21 '24 15:03 bahua

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

rbram avatar Mar 25 '24 17:03 rbram

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

bahua avatar Jul 02 '24 14:07 bahua

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.

apreiter18 avatar Jul 02 '24 15:07 apreiter18

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.

bahua avatar Jul 02 '24 15:07 bahua

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?

apreiter18 avatar Jul 02 '24 15:07 apreiter18

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.

bahua avatar Jul 02 '24 15:07 bahua