Run a query from JavaScript with diferent url endpoint

Hi all,

I have an api endpoint structured in the following way: https://api.affinity.co/persons/38706

Which returns me information. However I would like to create a javascript iterating the last element of the endpoint, here it is 38706. I would like to run the query by modifying this number from my javascript.

I have seen that you can do it with url parameters but when doing so I have the term '?id=' in the middle which does not work for the api I am calling. The query would see like this which is not supported by the API: https://api.affinity.co/persons/?id=38706.

Do you know how I could create a javascript and run a query with a variable id in this way https://api.affinity.co/persons/{{id}}?

Thank you!
Nelson

Add a JS query to call that API (call it query1) using additional scope:
In the JS query write
query1.trigger({
additionalScope: {
id: {{id}},
}
});
Check out this doc

1 Like