Dynamic Variables for API calls

Are we able to set dynamic variables for API calls based on the environment?

For instance, an API call to Xano should have the Headers of X-Data-Source test while when in production, it should have the Headers of X-Data-Source live.

Otherwise, each time we publish to live, we’d have to update these values individually?

If your only concern is x-data-source then you can use the Xano plugin


That said there are other instances where changing value based on the environment would be handy/helpful.

That said what I have done is put a variable in x-data-source as shown below.
image

What you could do with some work is connect the Headers to a collection that can be dynamic.
image

I too would like an option of a deployment feature script, but I don’t think that is available yet, however, you can request it here https://feedback.weweb.io/

Thanks Pete.

I didn’t use the Xano plug-in as it doesn’t allow me to add other Headers into my API call (such as Authorization). Using the Xano plug-in ties me in to using the Xano Auth plug-in.

Ironically, the Xano Auth plug-in only accounts for Live authentication, so you can’t auth into your test Xano environment.

Thus, using the Xano plug-in places you in a catch-22 situation :slight_smile:

Good idea on using the collections though! I’ll use that instead. Will also submit the feature request.

For anyone in future who chances upon this thread, here’s how I handled it in the end. Opted for variables instead of collections. The intention is to change these variables prior to deployment to live.