Would it be possible to make Query Param Key and Query Param Value dynamic? So we can have 1 setup but query more specific within the builder?
All fields should already accept Bricks Dynamic Data. Did you try it?
No, how and where?
If I want it to fetch wp post ID or a custom field?
Same question sort of. Or how can you pass a value from a user input form, ie. item number or select a date or select from lookup values and pass that value to the API Query Param Key and Values, that way only pull the necessary API data.
You can use Dynamic Routes with the {route} syntax. In the below example, if the url is “https://dummyjson.com/users/marc”, the related URL will be used to fetch the api.
I see how that would work to dynamically change the url, but what is you want to pass a query parameter (or two or three) to the api call from a form field? For example, in the below url, how would we pass a value to “shipId” instead of hardcoding it?
The idea is to have an front end form, user inputs or selects the ship or cruise date or whatever value we need to pass and return the api data, instead of returning all the data. Can this be done with your Pro Forms and API Query builder?
To be able to pass query parameters for say travel or order entry or lookup, from a bricks built front end and return the related api data would be total game changer!
To create such an URL with specific query params, you can simply use the Pro Forms “Redirect” action. In your final URL, to which the redirect is made, you can simply use the data from the form fields.
This way, on the new page that the user lands on, the URL will contain the appropriate query parameters for the API request.
What obviously doesn’t work is reloading via Ajax after the user changes the form. You could do that with the Node Editor, but that requires coding knowledge.
