Handling test vs live in APIs
Hi, I'm currently building up numerous APIs for a semi-live app, but having a few challenges in trying to determine if I'm working with a test or live source environment (in my case, bubble).
I already pass the X-Data-Source header from my bubble test instance, but my APIs also leverage external services for things like SMTP - of which also has a test and live environment. My goal is that if a request from bubble is targeting the "test" data source, I would like to also pass that request to my "test" SMTP service, so I am not ruining my delivery reputation by sending to garbage emails. As far as I can tell, there doesn't seem to be any way within an API workflow to check what data source is currently being targeted, or any other parameter that I can use to check if it's a test or live API request.
Is there any way in the API workflow to determine which data source was requested?
Comments
-
Looks like I've answered my own question, after spending hours trying to find a solution to this!!! Murphy strikes again…
For those struggling with this kind of scenario - there is a "$datasource" environment variable you can retrieve:
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