Is there a way to use test data in API calls?

Options
margaret-bf
margaret-bf Member
edited August 2023 in ❓Other questions

Currently, the Xano instance has 2 branches, one live and one inactive. I've been building and debugging a series of API endpoints in the inactive branch using test data. The next step would be to start initializing API calls from the front end of the app to make sure that data is being retrieved and displayed correctly. Is there a way to ensure that API calls sent to the inactive branch will query/edit test data only, not the live database?

Tagged:

Answers

  • Chris Coleman
    Chris Coleman Administrator

    ADMIN

    Options

    Hi, @margaret-bf. You can specify the use of test data from external API calls by sending the X-Data-Source header with the request. So, if you have a test data source called 'test', just send "X-Data-Source: test" as a header and any database operations in the function stack (except for Direct Database Query) will target the test data source.