Dynamic API endpoint in Data Source

What are you trying to accomplish
I’d like to connect an API data source where the API URL takes various dynamic query string parameters. For example:


I’d like to be able to do something like:

or as all of the variables I need are available in state, something like:

Code stack you are integrating Builder with

Any help would be greatly appreciated.

Hey @josh you can use both depending on what you are trying to achieve. Using window will help you if you are using web components or Shopify. Otherwise you can go ahead with state.
You can take a look at our docs and other forum posts for the reference:

@sheema Thanks for that, I could have sworn I tried that :man_facepalming:

1 Like

Happens to the best of us :sweat_smile: :+1:

This solution does not work for me. using for e.g below URL in API Data URL does not work

Parent_Category_ID is passed as query param to the page and i am using it to call API . i do not see ${state.location.query.Parent_Category_ID} getting resolved.

@krishwin Try removing the $ :slight_smile: