Testing your API
Run & Debug
The above screenshot shows an API endpoint that takes a Star Wars planet name and returns information about the planet using the Star Wars API (swapi.dev). They don't have an API that searches a planet by name so this function stack has to recursively loop through the returned planets and match up the user's request.
Step 1 - The "Include variable details during run" toggle
This option allows you to store all the detail of how your API request was run. This is very helpful for debugging what was returned by each individual function as it was executed.
Step 2 - Press Run and wait for a response
Depending how the nature of the business logic in your function stack, the response could happen very quickly or take time to execute. A countdown timer will show as soon as Run is pressed.
Here's an example of what the response looks like in our Star Wars API example:
This will show what the API is returning. In this case, it is a successful response so we see the object of the different planets coming back from the API. If there was an error, the status code and associated message would be displayed.
This contains three relevant pieces of information
- Statements - Statements represent each individual action that took place in the function stack. In the above picture labeled B2, notice that there are three (3) functions in the function stack. If you look at that Result, however, there are 14 total statements. This is because there is a for each loop that iterates over the results coming back from the API causing more statements than functions.
- Runtime - Shows how quickly all of the statements were executed.
Regardless of status, you're able to copy the result to the clipboard by clicking on the copy icon.
When the Function stack is executed within Xano, you'll be able to see the response time of each statement that was executed
A. Inputs & Environment Variables
B. More information - Click to expand for more detail.
C. Statements - Tells you each function that got executed and its associated runtime. This is very helpful in helping you diagnose what happened during each statement execution.
D. Statement detail - You can expand the details of any statement to see the inputs and what is being passed along to the subsequent statement.