API error: 200-OK in Postman but 403 in Bubble :/

Hey everyone,
I’m trying to connect to an API which I am able to connect to via Postman but I am not getting it to work in Bubble.

I’m getting the response:

There was an issue setting up your call.
Raw response for the API 
Status code 403

Here are my settings in API connector:

and settings in Postman:

Any help/advice is much appreciated.

Thank you!

1 Like

To start, you really don’t need the “/” after “.com” and before the “?” that starts your query parms. Also, you have probably already checked this, but in your API connector you have a placeholder in the API key parm. I am assuming you have not actually passed “MYKEY”

1 Like

You’re not setting a content type header in the api connector. Often the recieving end doesn’t now how to interpret the data you send without explicitly setting a content-type in the header. Check your postman headers for content type.

1 Like

Thank you for the reply.

I did change the real values to DOMAIN and MYKEY in the screenshot of my 1st post for security reasons. Of course I actually used valid domain and key.

Since I set the authentication to “None or self-handeld” they API-key in the domain should also not be an issue. Or I am wrong here?

Anyhow, I changed it so all parameters are set via the bubble interface. Also tried to add Content-Type: application/json to the header

… still getting a 403 :confused:

Thanks. The response header sais “application/json”… which I’ve tried with no luck

Looked at the first screenshots wrong. Since everything is a URL parameter, my thought would be to copy and paste the working URL from postman into the bubble API connector and see if that works first,. If that connection works great. Now add the parameter you need to modify.

A 403 error is typically an authentication error. Are you sure that you were including everything correctly?

1 Like

Jared.gibb is right about that 403 and how to test it. That having been said, it’s a bit odd to see an apikey sent in the query parms. Normally, it will be in the header, but your postman example works fine so…

Are you sure the apikey being passed in Bubble is exactly the same as that passed in Postman? Look at the first and last 5 characters and make sure you didn’t lose. a character copy/pasting.

1 Like

my thought would be to copy and paste the working URL from postman into the bubble API connector and see if that works first

That’s exactly what I thought and tried…

  • I copied the working URL from Postman into bubble API connector.
    Got the 403 so…
  • I added ‘Content-Type: application/json’ to the header.
    Still got a 403.
  • Changed the endpoint url to only mydomain.com and set the parameters via Bubble api connector parameter interface.
  • double and quadruple checked every character
  • also tried to with API Key in the header as suggested by @kb1flr (thanks!)
    but still getting a 403 :frowning:

A 403 error is typically an authentication error. Are you sure that you were including everything correctly?

Well I’m sure the values I am including are correct. But I am not sure if that is “everything”. :confused: I am missing obviously something and it’s driving me nuts. rrrrrr

2 Likes

do you have some special settings. going on in postman?
Screen Shot 2022-11-15 at 10.21.59 AM

1 Like

Not really, I disabled “cookie jar” to prevent cookies used.

I’ve contacted the support of the API provider…

It seems most likely that Bubble’s API Calls HTTP_USER_AGENT is empty which triggered a RewriteRule on their end and blocked me out.

What tricked me was that it was working in Postman. But I guess it’s absolutely possible that it works in Postman but not through Bubble.

Anyhow thanks a lot guys @kb1flr and @jared.gibb
Really appreciate your help!

So is it working now?

Yes… The API blocks requests that have no User-Agent set.
So setting a User-Agent with my app name in the header finally did the trick.

1 Like