Xano Documentation
Search…
⌃K

Utility Functions

Helper functions or one-off functions that don't have a category yet
Utility functions are a mix of helper functions or one-off functions that don't have a category yet. They contain functions that range from helping you debug and test your API endpoint, to functions that help you enforce.
  • Preconditions - Set conditions that must be true If not met, the request will stop.
  • HTTP Header - Set a custom HTTP Header for the API endpoint.
  • Sleep - Pause the executation of the function stack for a period of time.
  • Get All Input - Used for Webhooks
  • Calculate Distance - Map the latitute and longitude from two different points.
  • Stop & Debug - Stop the execution of the function stack and print out a value.
  • Return - Return a result and exit the function stack.

Preconditions

Preconditions are useful if you want to enforce that something is true and create an error message in the event it is not true.
Set conditions that must be true If not met, the request will stop. You can also specify an error message below.

HTTP Header

Set a custom HTTP header.

Sleep

Pauses execution of the Function stack and goes to sleep. (Think of it like waiting or pausing to execute).
In this example, the Sleep function is set to pause for 5 seconds.

Get All Input (Webhooks)

Gets The input from a Webhook and makes it available to use in the Function stack. For more information, see the Webhooks section.

Calculate Distance

Calculate the distance between two longitude/Latitude points

Stop & Debug

Stops execution of the Function Stack at a specified point and prints out the data. (This can be advantageous when testing and debugging complex logic in the Function Stack).
In this example, the specified value for Stop & Debug to print out is the variable "merchant."
In this example, Stop & Debug is inserted in the Function Stack where we wish to stop execution. Additionally, the specified data is printed out at the point where execution was stopped.

Return

Return will return a result and exit the Function Stack. Return can be especially useful with conditional logic that requires you to return something as soon as you have a certain result.
In this example, the Return function is shown in the response due to the condition that was met, despite var: result being defined in the response.