Forum Documentation Showcase Pricing Learn more

Additional Brackets in API URL

I’m connecting to the Knack API which isn’t an issue until I need to filter a list of results in the call. Here is the url structure I Knack requires.

url/records?filters=[{"field":"field_81", "operator":"is", "value":"RecordID"}]

I need to pass in a dynamic recordID but the problem I run into is that the API Connector won’t allow me to create a dynamic parameter with a set of brackets inside another set of brackets so if I try to set it up like this

url/records?filters=[{"field":"field_81", "operator":"is", "value":"[RecordID]"}]

I get a single parameter key/value asking for everything between the outer brackets.

Currently we have it working with the following setup

url/records?filters=[firstpart][ID][lastpart]

and then I pass each section of the filter through and only expose the ID as not private.

Haven’t had any issues to this point, just kind of curious if this is the only way to do it or is there a more legit way I can make this happen?

The issue is a conflict between Bubble and the API filter setting.
Maybe you can urlencode the first and last [] to %5B %5D ?
Another idea may be to set the first one [] and last one [] and set value to [ and last to ] (you can keep private because user will not change it.

will look like:
[initial]{“field”:“field_81”, “operator”:“is”, “value”:"[RecordID]"}[final]

That was a great idea! I hadn’t tried it before but unfortunately, it is not working either. I’ll leave it like it is at this point. It’s working fine, just seems a bit hacky.

Though I’m learning there is a lot more hackery in software than I ever knew lol

1 Like

Set the first square bracket up as a parameter and set it to a square bracket :slight_smile:

[b] = ‘[’

1 Like

:bell: That worked! Thanks, Nigel!

1 Like