How to make a data source conditional in my api endpoint

Options

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

  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Answer ✓
    Options

    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