How to make a data source conditional in my api endpoint
Options
chrstnstl
Member ✭
Hi, I'm planning on creating a conditional whether the data being used is “live" or “test”. If the data being used is “live”, I'll use the live api keys for my external api and if “test”, I'll use the test api keys for my external api. Do I make this by using $datasource == ‘live’ // $datasource == ‘test’? for my endpoint's conditional?
Best Answer
-
Hi @chrstnstl - Yes you are correct, the $datasource variable will tell you if it's == live or == test. So you can use that to determine the api keys you'd like to use
Answers
-
Thanks so much @Michael Udinski!
Categories
- All Categories
- 53 ? Announcements
- 47 ? Releases
- 37 ? Welcome
- 983 ? Help! I'm a Noob
- 125 ? No-Code Front-Ends
- 633 ? Working with APIs
- 439 ? Transforming data
- 126 ? Connect Xano to ...
- 50 ?? Find an Expert
- 348 ❓Other questions
- 35 ? Security
- 22 ✂️ Snippets
- 19 ? Showcase
- 7 ?️ Xano Chatter
- 62 ? Video Tutorials
- 171 ? Request a feature
- 229 ? Report a Bug
- 19 ? Templates & Extensions
- 7 ? Feedback