I’m using the API to post data.
In the parameters, I wrote an input with the plus (+) sign in it. When I initialize call, the response is an error, and I noticed that while calling, the plus ‘+’ sign is eliminated out of the parameter.
Is there anyone who can help me with this? Why is this happening?
What information regarding the brand name from the API provider did you uncover that would indicate how to properly format it…My assumption here is that the + symbol may be removed because it might not be used for API parameters generally which may require some type of standardization, which often comes in the form of URL encoded formats.
But, I’m not sure as I’ve never personally experienced this.
Normally when I deal with issues like these I first explore the API documentation from the provider, then google search the error codes I receive and read through code forums on the subject, both of which usually shed light on whether I was doing something wrong, or if there might actually be a bug in Bubble.
Keep in mind Bubble support does not provide support for APIs so if it is a bug within the API connector, you really need to have a lot of evidence to prove the issues is Bubble and not how you are attempting to setup the API call.
Thank you for taking a look.
But I’ve also tested the API on their side (I’m using Swagger) and it still works normally with the ‘+’ sign.
I also searched for similar cases but all I saw is this one Twilio - can't post the '+' sign in Twilio API Plugin
And I’m still not clear how he fixed the problem
URL encoding in some parts of Bubble are done automatically…once you have it initialized as it seems you do now, check against whether or not you need the URL encoded format when running the call in the system as Bubble may do that automatically for you.
You would probably experience similar problem with % sign if it’s followed by hex digits.
The + is an alias for %20 (space), thus when you use it in URL, it’s decoded into space symbol. Same about any %hh sequence: it will be decoded into symbol of hh hex code.
If you need to pass, let’s say, %20 literally, use %2520 instead.
In other words, when passing parameter value to be used in URL first replace all percents with %25, then all + signs with %2B, and all & signs with %26.
There’s JavaScript function that encodes URI values: encodeURIComponent() - JavaScript | MDN
You can find more information there (just for reference). Strictly speaking, any non-alphanumetic character should be encoded in query string, but encoding &(forgot to mention previously), +, % and in some cases space symbol is enough.