I’ve used Postman to create an API call and it is working fine.
Once I try to bring the same parameters over to the API Connector I keep getting a response that shows “400” and that the parameter “grant_type” is a missing parameter when you can clearly see it has been added to the body of the API call that I am initializing.
In this case, I suggest you to use the Correct content type in header.
Can you share the Postman Call so we can compare.
I suggest you to also send the request to requestbin.com url so you can compare the output and do the correction
I’ve tried to add the Content-Type application/x-www-form-urlencoded value to the body parameters of the request as well in API connector and it still hasn’t worked. I’ve basically tried everything.
It still is working fine in Postman.
Here is my request and you can see the successful response.
I would suggest checking what headers Postman has added onto this, make sure all are reflected in your API Connector, this is often what is making it not work in bubble
Check under temporary headers too for things like “Accept”, “Response”, etc.
Requestbin will show you exactly the content of your request. You canbyse the same url to send from postman and send from Bubble and compare both to 7nderstand the difference between each call. Most of the time this is related to header. I think that you should send screenshot of header and content received by requestbin so it will be easier for us to help you. You can also share the requestbin url so we can see it ourself (the url that show you the result of the request, not the url used to send the request). Only if you make it public
Because you seem to have trouble to understand how requestbin work, I’ve done test myself.
So if you just put no header and send your request, the content type is set to application/json.
If you add a header set to application/x-www-form-urlencoded, this will, again, overwrite and be application/json (this is why I tell you to test with requestbin because API connector in Bubble have some strange behavior that I’ve already discussed in another topic).
Now. If you keep the header and put {} in json body, you will have the right header… but parameters will not be sent.
Now let’s try something else. Instead of adding parameters, we will add it in the url like ?grant_type=[grant_type] … this will be application/x-www-form-urlencoded and grant_type will be sent as query parameters. This is better, but not perfect.
Finally, Try:
Content type header set to: application/x-www-form-urlencoded
Clear all other parameters, don’t set any parameters in url. And use a json body like:
{
"grant_type":"<grant_type>"
}
It’s work.
I know, it doesn’t make sense, but it’s actually how this work.
This is not really your issue but more a strange behavior od the API connector. It’s always hard to find when you don’t know which tool you can use to debug that.
do you have link do API Doc?
If you have correct informations in each fields, this look ok. 400 mean an authorization issue. The request is ok but maybe other information are not. Also, in some API’ you need to authorize the correct domain in API info.
Did you get any error message with the 400?
I think I found a way to make it work but not sure because I don’t have any key.
Try this
In header;
Content-Type value set to application/x-www-form-urlencoded
No parameters
body
grant_type=password&username=yourusername&password=yourpassword&client_id=yourid&client_secret=secretkey