id
stringlengths 14
14
| text
stringlengths 109
4.45k
| source
stringlengths 22
132
|
---|---|---|
43ec517d68b6-0 | There are two methods available to using external sorting - simple and classic. We recommend utilizing simple mode, but keep classic mode available for queries constructed prior to the availability of simple mode. Simple Mode Using Simple Mode for external sorting, you can easily set variables or values for the following options as pertains to sorting: Sort Sort Create an input of JSON type and use that variable in the External panel under the Sort option. In order to sort, we must enter in the JSON input in the following format: { { "sort": [ {"sortBy": "","orderBy": ""} ] } } Classic Mode (deprecated) How do I use the External query to sort? First, you must create an Input that is a JSON data type. The input named external is a JSON data type. Next, link the configuration in the External query tab to the JSON input using the drop down menu.
Additionally, select which permissions you want to grant for external use. In this example, the external configuration is mapped to the JSON input. Additionally, the 'Allow Sorting Override' is selected as a permission. Finally, we are ready to use the external query to sort.
In order to sort, we must enter in the JSON input in the following format: { { "sort": [ {"sortBy": "","orderBy": ""} ] } } For this example, it would look like this in Xano: In this example, "external" is the input as a JSON data type. This response will sort the data by the 'titles' of the 'book' table in ascending order. Note for order by:
asc = ascending
desc = descending Alternate to JSON input Front-ends can sometimes have limitations as far as the data you are able to pass as an input. Fortunately, Xano is super-flexible to allow you to workaround these limitations. If you are having issue passing a JSON object as an input in your front-end then you can create the object in the Function Stack as a variable and make it dynamic with scalar inputs. Step 1 Create the fields sortBy and orderBy as regular text inputs. Create order by and sort by text inputs. Step 2 Add a new Function Stack item: Create Variable Paste the JSON object into the input line and hit import JSON. Or create the object manually using the set filters. { { "sort": [ {"sortBy": "","orderBy": ""} ] } } Then map the sortBy and orderBy paths to their respective inputs. Map each input to the path they belong to. Step 3 Reorder your Create Variable function so that is before the Query All Records function. Then navigate to the External tab within the Query All Records and map it to the variable. Map the variable containing the JSON object and inputs to the by external query section. Previous External Tab Next External Filtering Last modified 3mo ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/functions/database-requests/query-all-records/external-query-manipulation/external-sorting |
9778d5d219c5-0 | There are two methods available to using external filtering - simple and classic.
We recommend utilizing simple mode, but keep classic mode available for queries constructed prior to the availability of simple mode.
Simple Mode Using Simple Mode for external filtering, you can easily set variables or values for the following options as pertains to sorting: Search Create an input of JSON type, and add it to the Search field in the External tab.
Because the external query takes a JSON input, we must format the input in a JSON like the examples below.
GET users with the email [email protected]: { "external": { "expression": [{ "statement": { "left": { "tag": "col", "operand": "user.email" }, "right": { "operand": "[email protected]" } } }] } } GET users with a score great than 10: { "external": { "expression": [{ "statement": { "left": { "tag": "col", "operand": "user.score" }, "op": ">", "right": { "operand": 10 } } }] } } GET users with the email [email protected] AND a score greater than 10: { "external": { "expression": [{ "statement": { "left": { "tag": "col", "operand": "user.email" }, "right": { "operand": "[email protected]" } } }, { "statement": { "left": { "tag": "col", "operand": "user.score" }, "op": ">", "right": { "operand": 10 } } }] } } GET users with the email [email protected] OR a score greater than 10: { "external": { "expression": [{ "statement": { "left": { "tag": "col", "operand": "user.email" }, "right": { "operand": "[email protected]" } } }, { "or": true, "statement": { "left": { "tag": "col", "operand": "user.score" }, "op": ">", "right": { "operand": 10 } } }] } } GET users with the email [email protected] AND a score greater than 10 or less than 5: { "external": { "expression": [{ "statement": { "left": { "tag": "col", "operand": "user.email" }, "right": { "operand": "[email protected]" } } }, { "type": "group", "group": { "expression": [{ "statement": { "left": { "tag": "col", "operand": "user.score" }, "op": ">", "right": { "operand": 10 } } }, { "or": true, "statement": { "left": { "tag": "col", "operand": "user.score" }, "op": "<", "right": { "operand": 5 } } }] } }] } } Classic Mode (deprecated) How do I use the external query to allow filtering additions?
First, create an input that is a JSON data type.
In this example, the input named "external" was added and is a JSON data type.
Next, link the configuration in the External query tab to the JSON input using the drop down menu.
Additionally, select "Allow Filtering Additions" permission.
In this example, under the External tab of the Query all Records function, we linked up the input "external" for external filtering.
Additionally, we selected the permission to Allow Filter Additions.
Now, we are ready to use the filter by external query.
Because the external query takes a JSON input, we must format the input in a JSON like the examples below. | https://docs.xano.com/working-with-data/functions/database-requests/query-all-records/external-query-manipulation/external-filtering |
9778d5d219c5-1 | GET users with the email [email protected]: { "external": { "expression": [{ "statement": { "left": { "tag": "col", "operand": "user.email" }, "right": { "operand": "[email protected]" } } }] } } In this example, the code block above is pasted into the Run & Debug.
This will filter by users with the email address "[email protected]."
GET users with a score greater than 10: { "external": { "expression": [{ "statement": { "left": { "tag": "col", "operand": "user.score" }, "op": ">", "right": { "operand": 10 } } }] } } GET users with the email [email protected] AND a score greater than 10: { "external": { "expression": [{ "statement": { "left": { "tag": "col", "operand": "user.email" }, "right": { "operand": "[email protected]" } } }, { "statement": { "left": { "tag": "col", "operand": "user.score" }, "op": ">", "right": { "operand": 10 } } }] } } GET users with the email [email protected] OR a score greater than 10: { "external": { "expression": [{ "statement": { "left": { "tag": "col", "operand": "user.email" }, "right": { "operand": "[email protected]" } } }, { "or": true, "statement": { "left": { "tag": "col", "operand": "user.score" }, "op": ">", "right": { "operand": 10 } } }] } } GET users with the email [email protected] AND a score greater than 10 or less than 5: { "external": { "expression": [{ "statement": { "left": { "tag": "col", "operand": "user.email" }, "right": { "operand": "[email protected]" } } }, { "type": "group", "group": { "expression": [{ "statement": { "left": { "tag": "col", "operand": "user.score" }, "op": ">", "right": { "operand": 10 } } }, { "or": true, "statement": { "left": { "tag": "col", "operand": "user.score" }, "op": "<", "right": { "operand": 5 } } }] } }] } } Need an alternative to the JSON input due to front-end limitations?
See the example from external sorting.
Previous External Sorting Next External Paging Last modified 3mo ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/functions/database-requests/query-all-records/external-query-manipulation/external-filtering |
fe9fc289c3ff-0 | There are two methods available to using external filtering - simple and classic.
We recommend utilizing simple mode, but keep classic mode available for queries constructed prior to the availability of simple mode.
Simple Mode Using Simple Mode for external paging, you can easily set variables or values for the following options as pertains to paging: Page
The current page of results Per Page
The amount of results per page Offset
Offset is available if you need to manually define an offset for the set of records returned.
The following example, assuming your record IDs start at 1, will return records 1 - 10
Page: 1
Per Page: 10
Offset: 0
The following example, assuming your record IDs start at 1, will return records 2 - 11
Page: 1
Per Page: 10
Offset: 1 To define your external parameters using simple mode, just specify your desired values or variables in the External tab: Classic Mode (deprecated) How do I use the external query to allow for paging override?
First, create an input that is a JSON data type.
In this example, we have added a JSON input named external to the GET all users API endpoint.
Secondly, open the Query all Records function.
In the Output tab, under return enable paging.
In the Output tab of the Query all Records function, click the pencil icon next to Return to enable paging.
Select the checkbox next to enable paging and click save.
Next, link the configuration in the External query tab to the JSON input using the drop down menu.
Additionally, select "Allow Page Override" and "Allow Per Page Override" permission.
(Note: you can choose just one between Page Override and Per Page Override or both.
Determine what works best for your use case).
In this example, we linked up the external configuration with the JSON input "external."
Then we selected permissions to allow page and per page override.
Note: you can choose one or the other or both depending on your requirements.
Now, we are ready do paging by the external query.
Because the external query takes a JSON input, we must format the input in a JSON like the examples below.
In this example, "external" is the name of our JSON input.
It is not required as part of the input but used as an example name.
The below JSON object uses both Page Override and Per Page Override.
It will return page 1 and 2 items per page: { "external":{"page":1, "per_page":2} } The below JSON input would be used for just Page Override: { "external":{"page":1} } The below JSON input would be used for just Per Page Override: { "external":{"per_page":2} } Alternative to JSON input Front-ends can sometimes have limitations as far as the data you are able to pass as an input.
Fortunately, Xano is super-flexible to allow you to workaround these limitations.
If you are having issue passing a JSON object as an input in your front-end then you can create the object in the Function Stack as a variable and make it dynamic with scalar inputs.
This method is also handy if you want to use page and per page as query and URL parameters.
Step 1: Create inputs "page" and "per_page" as integer input types.
(Or if you are just using one of the overrides use just that one).
Step 2: Add a Create Variable Function to your Function Stack and drag it to the top.
Create the following JSON structure using the SET filter or import JSON action.
{ "page": "", "per_page": "1" } Then, choose the inputs as the values for the corresponding paths: Create the JSON structure in a variable using the SET filer or import JSON.
Map the dynamic inputs as values to their corresponding paths.
Step 3: Ensure paging is enabled on the output tab of Query All Records.
Enable paging. | https://docs.xano.com/working-with-data/functions/database-requests/query-all-records/external-query-manipulation/external-paging |
fe9fc289c3ff-1 | Then, on the External tab map the variable you created to the By External Query dropdown and select Allow Page Override and Allow Per Page Override.
(If you are only using one then just select that one).
Map the variable created in step two to the external tab and select paging overrides.
Click save and you're ready to go.
Previous External Filtering Next Get Record Last modified 3mo ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/functions/database-requests/query-all-records/external-query-manipulation/external-paging |
68d30a959472-0 | Link to YouTube Video: https://www.youtube.com/watch?v=x4gfCvw_7LM Get Record retrieves a record from a database table by looking up a field. By default the Get Record function is set up to find a record based in the ID field but you can change this to any field you require. The Get Record is a shortcut function from the Query All Records function that should be used when you are looking for a single record and know which field you want to find that record by. Inputs - How to Get a Record: Field name: This is the name of the field (column) in your database table that you want to find the record by. Field name will be defaulted to the ID field but you can open the dropdown selector to choose from the list of different fields in the database table. Field value: This how you find the record based on the value of the field name. The field value is typically an input but can also come from things like a variable or the authenticated user ID. In this example, we are getting a record from the book table based in the ID field - we are finding the book based on the value of the input: book_id. Notice in the photo above: if you choose a field_value that maps to multiple records, then the first one found will be used. Open the dropdown selector to choose from the other fields in the table if you wish to get a record by a different field name: The dropdown selector allows you to choose from a different field name to get a record by. If you need to apply a special type of sorting, or find a record based on multiple fields then you should use the Query All Records function. Output - The response: The output tab of the Get Record function is similar to the Query All Records function but simplified. You can: Customize - Customize the response, meaning optionally pick and choose which fields you want included in the response. Use this if you only access to certain fields for your API and want to get rid of the unnecessary fields. (Fields have to be included in the response for you to access them elsewhere in your function stack). Addon - Use an Addon to extend the response from related database tables. Addons are covered in detail later in this section. Variable - Choose the name for the return variable which will store the data created from the function. In this example, you can see a preview of the response and the different options available from the output tab. Settings: Settings allow you to add a description or comments about what your function is doing. This will be displayed on the function stack to help you see clearly what each step is performing. Here you can add a description or comments about what the Get Record function is accomplishing. Previous External Paging Next Has Record Last modified 1yr ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/functions/database-requests/get-record |
3ef815416f77-0 | Link to YouTube Video: https://www.youtube.com/watch?v=HjW2d6g7NOg Has record checks to see is a record from the database has a value defined. In other words, it is checking is a record exists or not based on the field you are looking up. Has record will return a true or false value whether or not a record has a value. Often times, has record may be used with a conditional (If... then... else...) to perform other logic based on the result. Inputs: Field name: This is the name of the field (column) in your database table that you want to find the record by. Field name will be defaulted to the ID field but you can open the dropdown selector to choose from the list of different fields in the database table. Field value: This how you find the record based on the value of the field name. The field value is typically an input but can also come from things like a variable or the authenticated user ID. In this example, we are finding if a record has a value of ID = 1. If a record exists, the response will be true. Output The response will be a boolean (true or false). If a record exists (there is a record that has the specified value for the field) then the result will be true. If not, then the result will false. The result is stored in the variable. Settings Settings allow you to add a description or comments to describe what the function is doing. This is useful for ease of use in large function stacks to describe what each step is doing. Previous Get Record Next Edit Record Last modified 1yr ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/functions/database-requests/has-record |
93db85ed909c-0 | Link to YouTube Video: https://www.youtube.com/watch?v=e37MMmQA8fY Edit record will update an existing record. Editing a record is a full object replacement, which means the data you update the record with will replace the existing data. At times you may wish to update a record by merging new data with existing data. To do this you you will need to first get the existing data, manipulate it to include the new data then update the record using the edit record function. Other times, you may wish to update a field of a record only if the input for that field has a value. You can use conditional logic or conditional filters to conditionally edit the fields of a record. The Edit Record function finds the record to update based on a single field look up. By default, this field is set to the ID but you can change it to any field you want. Inputs Finding the record: Field name: This is the name of the field (column) in your database table that you want to find the record by. Field name will be defaulted to the ID field but you can open the dropdown selector to choose from the list of different fields in the database table. Field value: This how you find the record based on the value of the field name. The field value is typically an input but can also come from things like a variable or the authenticated user ID. In this example, we are finding a record to edit based on the id field. The record we find will have the value of the input product_id. Metadata: The metadata is the section that contains the different fields of the record from your database table. You can choose to ignore or hide a field if you do not wish to update it at all by toggling the icon in the top right corner of the field name box. The magic wand allows you to apply a single variable to all the fields at one time. This is useful when you have many fields and you are getting all or most of the data from the same variable. The Metadata is where you map fields to the data you want to update them by. You can ignore a field by toggling the eye icon. Additionally, you can apply a single variable to all the fields with the magic wand. Output The output is what data is returned in the return variable as a result of the function. You can customize which fields are to be included, use Addons to extend the data, or customize the name of the return variable. The output tab shows a preview of the response of the function and different options to manipulate it. Settings Settings allow you to add a description to the function. This will be displayed in the function stack to help you understand each step when you have complex function stacks. Optionally add a description to the function to help understand what this step is doing. Previous Has Record Next Delete Record Last modified 1yr ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/functions/database-requests/edit-record |
c7e1249ffc03-0 | Link to YouTube Video: https://www.youtube.com/watch?v=aWSkJgaWzhg Delete Record allows you to delete a record from a database table based on a single field look up. Inputs Finding the record to be deleted: Field name: This is the name of the field (column) in your database table that you want to find the record by. Field name will be defaulted to the ID field but you can open the dropdown selector to choose from the list of different fields in the database table. Field value: This is how you find the record based on the value of the field name. The field value is typically an input but can also come from things like a variable or the authenticated user ID. In this example, we will find and delete a record based on the ID field, the value will be from the input product_id. Output There is no response for the Delete Record function because the record is being deleted. On a successful run, the return variable will have a null value. There is no response when you delete a record. The return variable will be null. Settings Settings allow you to include a description for the function that will be displayed in the function stack, Previous Edit Record Next Add Record Last modified 3mo ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/functions/database-requests/delete-record |
2a38a4a9316c-0 | Link to YouTube Video: https://www.youtube.com/watch?v=-CfW1YV1OkM Adding a record to a Database Table 1.Select the fields to add to the Database You can add to the Database by either Using Inputs defined in the Inputs section one of the API group or by specifying inputs from a variable in the function stack. Adding a Database record using the API inputs (What's being passed from the front-end) Ignoring an input Sometimes you might want to ignore a field when create a Database record. A good example might be ignoring images uploaded by the user by creating a record with all the other fields. To do this, simply hover over the Database Field you want to ignore with your mouse and you will see an eye ball appear. Click the eyeball to hide the fields you want to ignore If you have many inputs you want to ignore, you can Hide/show all by Toggling the eyeball to the left of the Table Name on top of the inputs: Output The output is the Response of the add record function. There will be a preview of the response, which you can customize or include an Addon to extend the data. The response will be contained in the return variable, which you can customize the name of at the bottom of the output tab. The output tab lets you customize the response, include Addons, or customize the name of the return variable. Settings Settings allow you to add a description for the function to be displayed in the function stack. Optionally add a description for the function. Previous Delete Record Next Add or Edit Record Last modified 1yr ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/functions/database-requests/add-record |
7647966b7343-0 | Link to YouTube Video: https://www.youtube.com/watch?v=7nfn_TbpCSQ Add or Edit Record is a unique function that performs the following: Look for a record, if the record does not exist then add it to the database, if it does exist then update the record. The function will search through a database field for a record based on a specified field. If it does not find a matching record then the function will add a new record. If it finds an existing record, then it will update that record with the mapped data. One common use case for this function is when you are storing data from an external API in the database and this data sometimes has new information - whether that be updated records or new records. Inputs Finding a record by field: Field name: This is the name of the field (column) in your database table that you want to find the record by. Field name will be defaulted to the ID field but you can open the dropdown selector to choose from the list of different fields in the database table. Field value: This how you find the record based on the value of the field name. The field value is typically an input but can also come from things like a variable or the authenticated user ID. Choose which field to look up a record by with field_name. Field_value will determine the value of that field to look up the record. Metadata This is where you can map the fields to the data you wish to add or edit a record. Often times this is dynamic data in the form of inputs or outputs. You can hide fields that you do not wish to add or edit by toggling the eyeball icon in the top-right of the field name boxes. Additionally, you can quickly select all the fields to hide by selecting the eyeball icon at the top of the metadata section. The magic wand icon allows you to apply a single variable to all the fields below. This is helpful when you have many fields and are grabbing the data from a variable coming from something like an external API or webhook. You can hide fields that you do not want to add or edit. You can also quickly apply a single variable to all the fields. Also note that you can add filters to the input values for on the fly data transformation. Output The output is the Response of the Add or Edit record function. There will be a preview of the response, which you can customize or include an Addon to extend the data. The response will be contained in the return variable, which you can customize the name of at the bottom of the output tab. The output tab lets you customize the response, extend the response with addons, and choose the name of the return variable. Settings Settings allow you to add a description for the function to be displayed in the function stack. Optionally include a description of the function. Previous Add Record Next Database Transaction Last modified 1yr ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/functions/database-requests/untitled |
8613985ec49e-0 | Commit all records at once Database transaction allows you to treat a set of functions as a whole. Meaning that every function must succeed properly in order for all of them to be executed. Usually you would use this if you have two or more functions that are mission critical. Database transaction was created for financial systems. For example, during a transfer, if money is successfully withdrawn from one account but something goes wrong with the deposit to the second account, then you would want the entire transfer to be cancelled. Otherwise, the money would still be withdrawn from the first account even though it was never received by the second account. Note regarding Database Transactions: Keep in mind that only database functions are used when determining if the database transaction should be applied. This means that things like creating and updating variables, external API requests, and other functions that are not adding or editing records will still execute regardless of the outcome of the database transaction. Database Transaction:
Commit all records at once. Previous Add or Edit Record Next Clear All Records Last modified 4mo ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/functions/database-requests/database-transaction |
54229abfcfa5-0 | Clears all the records in the selected database table. Optionally reset the primary ID to 1.
Link to YouTube Video: https://www.youtube.com/watch?v=-r5_awWAPmA Clear All Records
Clear all records at once The Clear All Records function comes with warning because it will clear all the data in the table you choose. You should be absolutely sure you wish to delete this data because it cannot be recovered. The Clear All records function does exactly as it says, it is capable of clearing all of the data in a database table. This is useful for those times when your table has too much data that is no longer relevant or you want to get a clean slate after testing.
There is an option to reset the primary ID back to 1 or you can clear it without resetting the IDs.
Resetting the IDs works well when: You want to start fresh. When these ids don't affect your front end in any way (for example: a hardcoded specific ID used as a placeholder to show your objects, a static book that is on your front page). A good reason to continue your numbering and not reset your IDs: When you display the id in some form and want to show a higher number. Previous Database Transaction Next Bulk Add Records Last modified 1yr ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/functions/database-requests/clear-all-records |
92cc227532d1-0 | Add multiple records to your database in one line of your function stack.
Link to YouTube Video: https://www.youtube.com/watch?v=paoqky0wuJw Bulk Add Record This function will allow you to add multiple records to a table inside your Xano database in one step. Previously, you may have utilized a loop to accomplish this. Now, we can add multiple records from an object in a single line of your function stack. One of the ways you might utilize this function is if you have an external API call that is returning a list of users and their email addresses. You could use Bulk Add Record to insert all of these into your database in one step. Previous Clear All Records Next Data Manipulation Last modified 8mo ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/functions/database-requests/bulk-add-records |
98dce83da57b-0 | As the name suggests, this group of functions makes it very easy to store, and transform data based on any set of conditions that you define. Functions in Data Manipulation Create Variable
Create a Variable for use in the function stack or to display on the front-end. Update Variable
Take an existing variable being passed in the function stack and update it. Conditional
Define a set of functions that execute if something is true/false. Loops
If you have a list of items, you can iterate through each one and perform functions. Math
Add/subtract/divide and do much more with numbers Arrays
Functions specific to working with object lists Objects
Manipulate the key/values for objects in the function stack Text
Append, Prepend, Trim Replace and more. Previous Bulk Add Records Next Create Variable Last modified 1yr ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/functions/data-manipulation |
f4b9ec30ad9f-0 | Variables are one of the most important concepts to understand in Xano. You can think of Variables as containers that hold information. Their sole purpose is to label and store data in memory to be sent to your front-end or used in another function. When to create a Variable You want to create a variable when you want to create a temporary object in the function stack to either store an object that you want to return to the front-end, or to use it in a subsequent function. How to create a Variable The drop-down on the value field offers multiple options to make it easier to define the value of your Variable. If you were to display the hello_world_variable then your response would look like this Hello, world! In this example, we stored plain text in the variable but you can store any type of object you want! Previous Data Manipulation Next Update Variable Last modified 4mo ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/functions/data-manipulation/create-variable |
812b4ba287f5-0 | Variables are one of the most important concepts to understand in Xano. You can think of Variables as containers that hold information. Their sole purpose is to label and store data in memory to be sent to your front-end or used in another function. When to update a variable Sometimes you might want to take an existing variable being sent through the function stack and transform it. This could be as simple as taking lowercase letters and making them uppercase. The video example below shows just that example:
Link to YouTube Video: https://www.youtube.com/watch?v=4ldit-qypTU&t=157s A few other basic examples of when to use the Update Variable Function Doing math on values stored in variables before sending it to the front-end Changing Timezones Reformatting text strings Previous Create Variable Next Conditional Last modified 1yr ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/functions/data-manipulation/update-variable |
26657d5ff902-0 | Conditional statements are used to activate different functions based on the evaluation of a boolean(true/false).
Link to YouTube Video: https://www.youtube.com/watch?v=jPEoffVZsh4 The structure we are using is If - Then - Else.
A simple example:
IF
Today is Monday,
Then
Wake up at 7:00am,
Else
Wake up at 6:00am.
This means that every Monday(true), we will wake up at 7:00am but every other day(false) we will wake up at 6:00am. If
What would you like to evaluate? Then
What would you like to do if the above is true? Else
Otherwise, perform the following... In this example, we have a variable which is an array, we then use the Expression Builder to create the condition to run this Function. In this case, we check: if the first element of the array is 1
If this is true, then we create a new variable called new_var which is set with the value of "hello".
If the condition is false, then we create a new variable called new_var which is set with the value of "hello world". Either way, the variable new_var will contain the outcome of the conditional statement. Previous Update Variable Next Loops Last modified 3mo ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/functions/data-manipulation/conditional |
e2ef524fbf3d-0 | Loops allow you to continuously execute a set of functions across a list of items. An example might be if you have a list of items being returned from the database that you wanted to either modify or delete. Loops are a perfect use case for this scenario.
Link to YouTube Video: https://www.youtube.com/watch?v=jB72fRWgNoI There are a few different types of Loop functions: For Each Loop - Iterate through a list of items until the end of the list is reached For Loop - Iterate through a list a specific number of times While Loop - Iterate through a list while a condition is true Loop: Break - Break out of a loop Loop: Continue - Continue iterating through a list For Each Loop: Remove Entry - Remove the current entry from the list being iterated upon. Previous Conditional Next For Each Loop Last modified 1yr ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/functions/data-manipulation/loops |
ed3d2c21991e-0 | For Each loops are the most common type of loop used in building backend projects. It allows you to iterate through each item of a given list and do something. Example The simplest example is iterating through the results of a Query all Records function. In the screenshot below, you can see the contents of the My First Table Database table. Let's say we wanted to make an API endpoint that displays all the names in this table as lowercase WITHOUT changing the actual database values. This means that Winston, Sara and Anita would become winston, sara and anita when the API returns to the front-end. To do this using a foreach loop it would look like the following: Step 1- Query all records from My First Table to get the list of users. You can see below it is returning the list of users as a variable called users Step 2- Add a For Each Loop and select users as the list you want to iterate through. By default, each item in the list is returned as item but for this example we'll change it to user (this is optional) so it's clear we're working with users. Step 3 - CLICK SAVE and re-open the for each function. Step 4 - Now that we've defined the list (users) we want to iterate through, we need to specify what we want to do with each user . In this case we want to ensure each name in user is lowercase. We can do this with an Update Variable function. You can see we started by selecting the user variable for the Existing Variable field, then used dot notation to specify we wanted the name field in the user object. We then specified the same variable user.name in the Value field and used the filter to_lower to take the existing name and make it lowercase. Step 5 - We make sure the response is returning users and if we've done everything right, we can see the names are all lowercase in our response: If we actually wanted to save the lowercase values to the database instead of displaying them in the API we would have used the Edit Record Database function in the for loop instead of Update Variable Previous Loops Next For Loop Last modified 3mo ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/functions/data-manipulation/loops/for-each-loop |
ac627ab1ccbd-0 | For Loops are used to run functions a specific number of times. You are presented with two options: the number of loop iterations, and the loop index variable. Number of Loop Iterations: the amount of times you want this loop to execute Loop Index Variable: the variable that maintains the index of the current iteration. Starting at 0, the current iteration that the loop is working through. There are other special commands that can be used with loops which will be seen in the upcoming pages. Loop: Break
Loop: Continue
Loop: Save Entry
Loop: Remove Entry Previous For Each Loop Next While Loop Last modified 3mo ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/functions/data-manipulation/loops/for-loop |
f899139df5e1-0 | While loops allow you to continue looping through a set of functions while a condition defined in the expression builder evaluates as true. In the below example, we are defining a condition where the functions inside of the While loop will continue to execute as long as the count of items in our array is greater than 6. There are other special commands that can be used with loops which will be seen in the upcoming pages. Loop: Break
Loop: Continue
Loop: Save Entry
Loop: Remove Entry Previous For Loop Next Loop: Break Last modified 3mo ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/functions/data-manipulation/loops/while-loop |
38b3eff8baf5-0 | Loop: Break
BREAK OUT OF LOOP.
This function will stop execution of both the current iteration and all remaining iterations. This fully breaks out of the loop. Previous While Loop Next Loop: Continue Last modified 3mo ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/functions/data-manipulation/loops/loop-break |
ec8956637a99-0 | Loop: Continue
GO TO NEXT ITERATION OF LOOP.
This function will stop execution within the current Function Stack and re-start at the beginning using a new iteration cycle. Previous Loop: Break Next For Each Loop: Remove Entry Last modified 3mo ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/functions/data-manipulation/loops/loop-continue |
6974ce5ac660-0 | Loop: Remove Entry
This removes the current entry from the loop entirely. Useful if you are referencing the set of data the loop is iterating on as a whole outside of the loop, but need it to match with the dataset that the loop has iterated through. Previous Loop: Continue Next Math Last modified 3mo ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/functions/data-manipulation/loops/loop-remove-entry |
c9e1074f5b3f-0 | When building your backend application, the likelihood of you needing to work with and transform numbers is very high.
That's why Xano has a series of Math functions and filters that allow you to do whatever you want.
Link to YouTube Video: https://www.youtube.com/watch?v=OJtsO-R9VBI Examples For each of these examples, we will Create a variable number with the value of 5.
Add Number
Add a number to an existing variable.
In the above example, the number variable would be 15 Subtract Number
Subtract a number from an existing variable.
In the above example, the number variable would be 2 Multiply Number
Multiply a number by an existing variable.
In the above example, the number variable would be 60 Divide Number
Divide an existing variable by a number.
In the above example, the number variable would be 1 Modulus Number
Get the remainder when an existing variable is divided by a number.
In the above example, the number variable would be 1 Bitwise Operators
Working on bytes, or Data Types comprising of bytes like ints, floats, doubles or even data structures that store large amounts of bytes is normal for a programmer.
In some cases, a programmer needs to go beyond this - that is to say, on a deeper level where the importance of bits is realized.
Operations with bits are used in Data Compression (data is compressed by converting it from one representation to another, to reduce the space), Exclusive-Or Encryption (an algorithm to encrypt the data for safety issues).
In order to encode, decode, or compress files we have to extract the data at bit level.
Bitwise Operations are faster and closer to the system and sometimes optimize the program to a good level.
We all know that 1 byte comprises of 8 bits and any integer or character can be represented using bits in computers, which we call its binary form(contains only 1 or 0) or in its base 2 form.
Real-world use cases of Bitwise Operators (Stack Overflow) Bitwise AND
The output of bitwise AND is 1 if the corresponding bits of two operands is 1.
If either bit of an operand is 0, the result of the corresponding bit is evaluated to 0.
Here's an example with the binary values written out: 12 = 00001100 (In Binary) 25 = 00011001 (In Binary) Bit Operation of 12 and 25 00001100 & 00011001 ________ 00001000 = 8 (In decimal) We will set up the same example in Xano and change the number variable to 12.
And for the API action we will use Bitwise AND with the value 25: In the above example, the number variable would be 8 Bitwise OR
The output of bitwise OR is 1 if at least one corresponding bit of two operands is 1.
In C Programming, bitwise OR operator is denoted by |.
Here's an example with the binary values written out: 12 = 00001100 (In Binary) 25 = 00011001 (In Binary) Bitwise OR Operation of 12 and 25 00001100 | 00011001 ________ 00011101 = 29 (In decimal) We will set up the same example in Xano and change the number variable to 12.
And for the API action we will use Bitwise OR with the value 25: In the above example, the number variable would be 29 Bitwise XOR
The result of bitwise XOR operator is 1 if the corresponding bits of two operands are opposite.
It is denoted by ^.
The exclusive-or operation takes two inputs and returns a 1 if either one or the other of the inputs is a 1, but not if both are. | https://docs.xano.com/working-with-data/functions/data-manipulation/math-manipulation |
c9e1074f5b3f-1 | That is, if both inputs are 1 or both inputs are 0, it returns 0.
Bitwise exclusive-or, with the operator of a caret, ^, performs the exclusive-or operation on each pair of bits.
Exclusive-or is commonly abbreviated XOR.
Here's an example with the binary values written out: 12 = 00001100 (In Binary) 25 = 00011001 (In Binary) Bitwise XOR Operation of 12 and 25 00001100 ^ 00011001 ________ 00010101 = 21 (In decimal) We will set up the same example in Xano and change the number variable to 12.
And for the API action we will use Bitwise XOR with the value 25: In the above example, the number variable would be 21 Previous For Each Loop: Remove Entry Next Arrays Last modified 3mo ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/functions/data-manipulation/math-manipulation |
65b9eea6e1cc-0 | Arrays are also known as lists.
Arrays may contain a single item or they may contain many items.
It's important to know that Arrays behave differently than other data types and typically require you to iterate over them in order to transform data.
These iterations are usually done in the form of Loops.
However, Xano can abstract some common data transformation of Arrays by removing the Loops and some additional logic in the form of these Array functions: Add to End of Array - Add an element to the end of an array.
Add to Beginning of Array - Add an element to the beginning of an array.
Remove from End of Array - Remove an element from the end of an array.
Remove from Beginning of Array - Remove an element from the beginning of an array.
Merge - Merge an array with an existing array.
Find First Element - Find the first matched element in an array.
Find First Element Index - Find the index of the first matched element in an array.
Has Any Element - Find out if there are any matched elements in an array.
Has Every Element - Find out if every element matches the expression you define.
Find All Elements - Find all the matching elements in an array.
Get Element Count - Get a count of the number of matched elements in an array.
Link to YouTube Video: https://www.youtube.com/watch?v=zPjd2VYT97g Examples For each of these examples, we will create a variable called array_1 with the value of Array [ 1, 2, 3, 4, 2, 1 ] Add to End of Array Add an element to the end of an array and return the updated array.
This is an easy way to add a new value to the end of an existing array.
Choose the existing array's return variable.
Then put the value you wish to add to the end of the array.
(This value can of course be dynamic).
The result is the updated array with new value, 9, added to the end of it: Add to Beginning of Array Add an element to the beginning of an array and return the updated array.
This is an easy way to add a new value to the beginning of an existing array.
Choose the existing array's return variable.
Then put the value you wish to add to the beginning of the array.
(This value can of course be dynamic).
The result is the updated array with new value, 99, added to the beginning of it: Remove from End of Array This function will automatically remove the element from the end of the array and return the update array.
If you want to return the removed element, you can add an optional return variable.
Select the variable of the existing array that you wish to remove the last element from.
When returning array_1, the result is the updated array with the element on the end removed.
If the return is array_1.
When returning the return variable, item, the result is the removed element.
If the return is item.
Remove from Beginning of Array This function will automatically remove the element from the beginning of the array and return the updated array.
Add a return variable if you wish to return the removed element.
Select the variable of the existing array that you wish to remove the first element from.
Array_1 will be updated to remove the element from the beginning of the array.
Example will return the removed element.
The result is the updated array (array_1) with the element at the beginning removed.
The updated array with the element at the beginning removed (1).
The result of the return variable "example" will be the removed element.
Merge Merge will merge one array with another existing array.
For this example, we will create a second array on the "value" line of the function.
This is where we put the array that we wish to merge into the existing array.
We can create arrays by typing them into the input line or using push filters. | https://docs.xano.com/working-with-data/functions/data-manipulation/arrays |
65b9eea6e1cc-1 | // for this example we are using the following to merge with array_1 [ 99, 98, 97 ] Here we are merging [99,98,97] with array_1.
The result is the updated array_1 with the new array merged into it.
The updated array with the two arrays merged together.
Merging is also accessible through filters such as merge and merge_recursive.
Note: The Expression Builder and $this Variable The following array functions require the use of the Expression Builder.
In these functions, the Expression Builder uses "where" statements to choose an element to look for.
The variable $this will be used as a variable substitution in the Expression Builder.
$this represents the existing array you are searching through for each element of the array.
$this is abstracting the complexity and need to loop through the array in order to transform or manipulate the data.
Find First Element Find the first matched element.
This function requires the use of the Expression Builder to choose which element to look for.
In this example, we are looking for the first instance of the number 4.
If there wasn't a number 4 then this would return as a "null" value.
The expression builder for this example looks like this.
Use $this variable and choose from different operators to determine what you wish to match.
You can add additional where statements with and, or, and groups, or or groups.
The result is the first matched element from the array.
Find First Element Index Finds the index of the first matched element.
The index is the position of the element in an array starting at 0 as the first element.
This function requires the use of the Expression Builder to choose which element to look for.
In this example, we are looking for the index of the first instance of the number 3.
If there wasn't a number 3 then this would return a -1.
In this example, array_1= [ 1, 2, 3, 4, 2, 1] and the first instance of 3 would have an index of 2 The result: In this example, array_1= [ 1, 2, 3, 4, 2, 1] and the first instance of 3 would have an index of 2 Has Any Element Find out if there are any matched elements.
This function will return a true or false value based on the result.
This function requires the use of the Expression Builder to choose which element to look for.
In this example, we are checking to see if the array has any values greater than(>) 2.
If there is a number > 2 then this would return a true if not, it would return a false.
The result: In the above example, we are checking if the array has any element that is greater than(>) 2, it returns a true.
Has Every Element Find out if every element matches.
This function will return true or false depending on the result.
Each element of the array must match the expression for it to be true.
This function requires the use of the Expression Builder to choose which element to look for.
In this example, we are checking to see if all of the array values are greater than(>) 2.
If all of the numbers are > 2 then this would return a true if not, it would return a false.
The result: In the above example, we are checking if all of the elements are greater than(>) 2, it returns a false Find All Elements Find all the matched elements.
This function requires the use of the Expression Builder to choose which element to look for.
In this example, we are looking for elements that are greater than(>) 2.
If any numbers are > 2 then this would return those values.
The result: [3,4] both match the expression $this > 2. | https://docs.xano.com/working-with-data/functions/data-manipulation/arrays |
65b9eea6e1cc-2 | // In the above example, there would be a new array called // `find` that is created that looks like this [ 3, 4 ] Get Element Count Get the number of matched elements.
This function requires the use of the Expression Builder to choose which element to look for.
In this example, we are looking for the count of the elements that are = 2.
If any numbers are = 2 then this would return the count of those elements.
The result: In the example above, we are creating a new variable called find and checking how many elements are = 2.
It returns 2 since array_1 has two values of 2.
Previous Math Next Objects Last modified 1yr ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/functions/data-manipulation/arrays |
f0935e4cd592-0 | This function allows you to get the properties of specified object. These functions are used when you need to get the properties of an objection in the function stack. Get Keys - Get the property names of an object as an array. Get Values - Get the property values of an object as an array. Get Entries - Get the property entries of an object as an array Examples For each of these examples, we will create a variable called object with the value { "a":"3", "b":"2", "c":"1" } Get Keys Get the property names of an object as an array. In the above example, the object is changed to an array { "a", "b", "c" } Get Values Get the property values of an object as an array. In the above example, the object is changed to an array { "3", "2", "1" } Get Entries Get the property entries of an object as an array In the above example, The object is changed to an array [ { "key":"a", "value":"3" }, { "key":"b", "value":"2" }, { "key":"c", "value":"1" } ] Previous Arrays Next Text Last modified 3mo ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/functions/data-manipulation/objects |
a97da629b098-0 | Text functions are used to Append - Append text to an existing variable. Prepend - Append text to an existing variable. Trim - Trim characters from both sides. Left Trim - Trim characters from the left side. Right Trim - Trim characters from the right side. Start with - Checks if text is present at the beginning Ends with - Checks if text is present at the end. Contains - Checks if text is found within the variable.
Link to YouTube Video: https://www.youtube.com/watch?v=b80IztA4kWo Examples For each of these examples, we will use the variable text with the value of "hello". Append Append text to an existing variable. The variable text becomes: "hello, how are you" Prepend Prepend text to an existing variable. The variable text becomes Person's name hello Trim Trim characters from both sides. This is great when the text has special characters in the front and back to separate it. For example: &hello& you can then trim the & off the left and right of the word. The variable text becomes: llo Left Trim Trim characters from the left side. The variable text becomes: lo Right Trim Trim characters from the right side. The variable text becomes: he Starts with Checks if text is present at the beginning. If it does it returns a value of true, if it doesn't it returns a value of false. These values are set in a new variable. In these next examples, we will store it in the result. This version is case-sensitive. This returns the variable result with the value of false. Starts with(case-insensitive) Checks if text is present at the beginning. Now let's try the exact same example as the one above. This returns the variable result with the value of "true". Ends with Checks if text is present at the end. Ends with(case-insensitive) Checks if text is present at the end. This returns the variable result with the value of true. Contains Checks if text is found within the variable. This returns the variable Result with the value of false. Contains(case-insensitive): Checks if text is found within the variable. Now let's try the exact same example as the one above. This returns the variable Result with the value of true. Previous Objects Next Security Last modified 3mo ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/functions/data-manipulation/text-manipulation |
a3c65c297427-0 | Security functions are a mix of helper functions and cryptography/encryption functions to bring added security to your function stack and application.
UUID - Generate a globally unique identifier.
Create Authentication Token - Create a Token used for Authentication.
Validate (Check) Password - Validate a match against a hashed password.
Generate Password - Generate a password.
Random Number - Generate a random number Create Secret Key - Create a secret key.
Create RSA Secret - Create a RSA secret.
Create Elliptic Curve Key - Create Elliptic Curve key.
JWE Encode - Encode a payload as a JWS token.
JWE Decode - Decode a JWE token.
JWS Encode - Encode a payload as a JWS token.
JWS Decode - Decode a JWS token.
Encrypt - Encrypt a payload as raw binary data.
Decrypt - Decrypt a payload to its original form.
Examples and additional content UUID Generate a globally unique identifier.
The industry standard UUID (Universally Unique Identifier - version 4) i.e.
9bcc06a9-9782-4859-a69f-778a7f28d666 Create Authentication Token Create a Token used for Authentication.
Authentication is an important concept in app building, you can read more about it here.
dbtable: Refers to a database table that has authentication enabled.
Select the table you wish to authenticate against id: The ID to be stored in the token.
Typically, this is a user ID, which you will get from a user record.
extras: Extras allow you to store additional data in the authentication token.
An example of this may be a user's role.
Use the SET filter to define a path and the value of the extra.
Read more about extras.
expiration: The amount of time, in seconds, the authentication token will last.
You can set this to a very large number if you don't plan on having the token expire.
Return variable: Contains the output of the created authentication token.
Creating an authentication token is fully customizable.
Validate (Check) Password Return the result of a plaintext password matching a hashed password.
Generate Password Generates a password.
character_count - Number of required characters require_lowercase - True/false if lowercase characters are required.
require_uppercase - True/false if uppercase characters are required.
require_digit - True/false if a numerical digit is required.
require_symbol - True/false if special symbols are required.
symbol_whitelist - Optionally whitelist a symbol.
Return variable - Returns the generate password in a variable.
Random Number Generate a random number.
Create Secret Key Create RSA Secret Create Elliptic Curve Key JWE Encode Encode a payload as a JWE token.
JWE Decode Decode a JWE token.
JWS Encode Encode a payload as aJWS token.
JWS Decode Decode a JWS token.
Encrypt Encrypt a payload as raw binary data.
Data - add the data or payload that you want to encrypt Algorithm - choose between six algorithms (cbc or gcm) Key - A key can be generated from one key generating function or you can insert raw text as your key.
This same key will be needed to decrypt the data.
IV - This is either 16 or 12 characters depending on your algorithm (cbc requires 16 characters and gcm requires 12).
This information should be kept hidden in an env variable.
If you are sending encrypted data to someone, then they would need to know this.
Tip: For certain use cases when passing the encrypted value through a URL, it is recommended to use the base64_encode_urlsafe filter.
Decrypt Decrypt a payload to its original form.
Examples JWE Encode/Decode Example This tutorial gives an example of encrypting and decrypting data stored in Xano.
Link to YouTube Video: https://www.youtube.com/watch?v=ydOlrknsMnw&feature=youtu.be JWS Encode/Decode Example Using your own key We can use our own encryption key when encoding and decoding JWS. | https://docs.xano.com/working-with-data/functions/security |
a3c65c297427-1 | First, use the Create Secret Key function to generate a secret key.
It's a good idea to store the key in a safe, reusable place such as in an environment variable.
Click the copy result button on the result of the secret key.
Copy the secret key.
Navigate to the settings page and add your secret key as an environment variable.
Add the secret key as an environment variable.
Next, use the JWS Encode function to encrypt a payload.
In this example, we will encrypt a simple text string.
Be sure to use the secret key stored in the environment variable as the key.
Optionally add a ttl or time to live if you want the token to expire.
The result is an encrypted JWS token.
The JWS token.
To decode the JWS token, we must make sure to use the same key used for encrypting it.
The result is our decrypted message.
The decrypted payload.
Using an external key Sometimes you may be using a service that requires you to decode or decrypt a JWS token.
Like the above example, it is recommended that you store the key in an environment variable for safe keeping and so that you may call it wherever you may need it in your workspace.
Use an environment variable to store the external secret key.
When decoding the JWS from the external source, be sure to use the environment variable as the decryption key.
Ensure the algorithm matches what's defined from the external source.
Time drift helps account for a leeway if clocks are not aligned.
Consider a time drift if there is an expiration on the JWS.
JWE vs JWS The main difference between JWE and JWS is one is able to be seen but not tampered with and the other is encrypted and not tampered with.
JWS is able to be seen (with the right decryption) but not tampered.
JWE is encrypted and not tampered with.
Example using JWT.IO We can use jwt.io to see an example of the difference between JWE and JWS.
First let's encode a JWE token.
When we place the resulting JWE token into jwt.io, we can see that the result is an encrypted payload.
Next, let's generate a JWS token in Xano.
When we place the resulting JWS token in jwt.io and match up the correct algorithm, we are able to see the payload.
Previous Text Next Data Caching Last modified 2mo ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/functions/security |
2723d092b638-0 | Data Caching functions powered by Redis.
Xano provides a data caching service powered by Redis that allows you to temporarily store data in memory for high-performance data retrieval and storage purposes.
This is great for storing temporary data that needs to be quickly generated and accessed for a period of time.
Link to YouTube Video: https://www.youtube.com/watch?v=DVGP5c3XS9o When to use Data Caching Learn more about how to set Caching up and best practices 1.
For API Queries that take a long time to process
Imagine that your front-end or your users want to generate a complex daily report from tens or even hundreds of thousands of records in your Xano Database.
Because there could be complex calculations executing across a large data set, it could take a while for the actual query to process.
Longer than you or your users want to wait.
Instead of directly querying the database every time your user wants this information, Xano can store the data in memory.
You can store things in the data cache ahead of time using something like a Background Task (also called a Cache Worker), or you can store it after the first time the user requests the data.
Example Use Case: Your boss wants to generate a daily report on how their million products are doing.
They don't have the time to wait around.
So you generate the report at the end of each day using a nightly Background Task and use Data Caching to store the report in memory so it's ready for the boss and anyone else that needs access to it.
📕 How-to Guide: Storing an API Response in Memory 2.
For Rate Limiting Purposes
Rate limiting is used to limit the consumption of a resource by a user of any given application.
As you may know, we rate limit our Explore (Free) Plan so users don't consume too many resources.
Many apps use rate limiting to prevent DDOS attacks, for server stability and consistency, or simply for cost control.
The most common way to set this up is using the Bucketing method, which basically means if each request to your API is like a drop in a bucket, your API can only be used until the Bucket is filled.
Then it will stop working.
Here's typically how it works Define the size of the "Bucket" and increment the count every time the API is hit.
Get the current count in the Bucket to make sure it hasn't exceeded the max size Set the Bucket TTL (Time to Live a.k.a Expiration time) Data Caching has a unique feature of allowing you to set an expiration date (TTL) so you can expire the "Bucket" count.
Example Use Case: Imagine you were building an app like Twitter and wanted to limit each user to posting 10 tweets per 20 seconds so you didn't overload the server.
You would set up your Post Tweet API endpoint to add a "Drop" to the Data Cache (Bucket) up to 10 drops every time the API endpoint is hit and then have that bucket empty (or expire) every 20 seconds.
How much can I store in the Cache?
Scale plans have up to 100MB of storage in cache.
If you require more than 100MB of cache, please send us a message.
How long can I store data in the Data Cache?
Through the cache functions you use, you can manually set how long data gets stored, or you can expect it to naturally get overwritten once it reaches the 100MB limit. | https://docs.xano.com/working-with-data/functions/data-caching |
2723d092b638-1 | NOTE: As mentioned above, Data Caching is temporary storage - so never store something that can't be recovered - if permanent storage is required, then the database can and should be used but performance may not be as good Caching Best Practices Individual Caching Functions Set a Cache Value Set a Cache Value Get a Cache Value Get a Cache Value Has a Cache Value Has a Cache Value Delete a Cache Value Delete Cache Value Increment Cache Value Increment Cache Value Decrement Cache Value Decrement Cache Value Get Cache Keys Get Cache Keys Rate Limit Rate Limit Previous Security Next Caching Best Practices Last modified 11mo ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/functions/data-caching |
5f93f983524d-0 | Often times in our applications we work with external APIs or 3rd party services.
Occasionally, the external server can be slow or the payload is complex and large, slowing down the response time.
With Xano's Response Caching powered by Redis, you can significantly increase response times by storing the data on memory.
Response Caching
Link to YouTube Video: https://www.youtube.com/watch?v=LD6FkTlh1Ns Watch a practical example of Response Caching using the Star Wars API From the settings of an API Endpoint or Custom Function response caching can be accessed.
Response caching is an abstracted caching method to cache the response of an endpoint or function.
Open settings and enable caching.
You can choose from a number of different settings to determine how to cache the response.
Response caching gives you granularity to choose how to cache the response of your queries.
TTL - Stands for time to live.
This defines how long to cache the response for.
Options range from 5 seconds to 7 days.
After the TTL expires, the query will run normally and reset the response cache.
Use inputs for caching signature - This is defaulted to yes.
It will create a response cache for each new or unique set of inputs for the duration of the TTL.
Use IP address for caching signature - This is defaulted to no.
It can be used if you wish to record a response cache on a per IP address basis.
HTTP Request Header Names - This is optional.
You are able to cache the HTTP request headers of the response.
Add the request header name or names that you wish to cache.
Environment Variable Names - This is optional.
It allows you to cache any defined environment variable names to the response cache.
Use Authentication ID for caching signature - When an API endpoint requires authentication, this option becomes available.
This can be turned on to enable a caching on a per user basis for authenticated endpoints.
When Authentication is enabled, you can use the Authentication ID for caching signature.
Example Use Cases Use inputs and disable authentication ID for caching signature Company statistics for your entire team.
If you need to display company statistics for your entire team then you may consider using inputs and disabling authentication ID for caching signature.
You API endpoint would require authentication so that only your team can access the API but you would disable the authentication ID for caching.
This would make it so the cache response is not on a per user basis.
Since it is company statistics you want each user to see the same statistics.
Using inputs enables each searched or inputted value gets cached, so if other team members search or input the same values then the response will already be there.
Use inputs and use authentication ID for caching signature Personal statistics.
In this scenario you would enable both inputs and authentication ID for caching signature.
This would cache responses on a per user basis.
For example, you might have each individual sales rep reviewing their own statistics for the quarter.
Enabling inputs would cache the response for each inputted value.
Additionally, enabling authentication ID for caching signature (with the appropriate business logic) would cache the responses on a per user basis.
Disable inputs and disable authentication ID for caching signature There's a movie night event and you want to generate a random movie.
Imagine you have an API that inputs a category or genre of movie and based on that, returns a random movie.
By disabling both inputs and authentication ID for caching signature, this will allow for the first search on this API to generate a random movie to be played during movie night.
It won't matter what other people search.
So if the first person searched Science-Fiction and the result is Star Wars then all other searches (drama, action, comedy, etc.)
will return Star Wars.
Now you have your random movie for movie night.
Data Caching Functions Data Caching Functions can allow for granular control over the data being cached in the Function Stack.
This can allow you to cache specific variables or data to increase query performance. | https://docs.xano.com/working-with-data/functions/data-caching/caching-best-practices |
5f93f983524d-1 | Learn more by seeing the guide.
Data Caching Previous Data Caching Next Set a Cache Value Last modified 1yr ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/functions/data-caching/caching-best-practices |
698d51a19d8a-0 | Redis Cache Values work in key-value pairs. Set a Cache Value function allows you to define a key to reference the cache value in other cache functions. The data input is where you define the data you wish to be cached (the value of the pair). Ttl stands for time to live. Set this, in seconds, to determine how long to cache the data for. Key: define a key name to reference the cache value by. Data: select the value that you wish to cache. This will often be a variable containing data. TTL: define how long, in seconds, for the cache to last. After this time expires, the query will run normally again and reset the data cache value for the specified time. Set this equal to 0 never reset the cache value. Previous Caching Best Practices Next Get a Cache Value Last modified 3mo ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/functions/data-caching/set-a-cache-value |
7f6ffaa6bb0b-0 | Get a Cache Value allows you to retrieve a cache value based on the defined key of a set cache value. Get a Cache Value function also outputs a variable so that you can use the data from the cache value in other functions or in the response. Key: enter in the key of a set cache value that you wish to retrieve. Previous Set a Cache Value Next Has a Cache Value Last modified 3mo ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/functions/data-caching/get-a-cache-value |
73278a4a8696-0 | Has a Cache Value allows you to determine whether or not a cache value exists based on the key. This function will return a boolean of true or false as a variable depending on if the cache value exists. Key: enter a key to find if a cache value exists. The return variable result will look like this: Because the key "user_info" has a cache value, the return variable is true. Previous Get a Cache Value Next Delete Cache Value Last modified 3mo ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/functions/data-caching/has-a-cache-value |
5fd0b37cd7db-0 | Delete cache value will delete a cache value based on the key of the cache value. Key: enter in the key of a set cache value in order to delete it. If we try to Get Cache Value for the same key after it is deleted, the response will come back as false. In this example, we are doing a Get Cache Value for the same key that is being deleted in the prior step. We will try to return the return variable of the Get Cache Value. The Get Cache Value returned a result of false because the cache value was already deleted. Previous Has a Cache Value Next Increment Cache Value Last modified 3mo ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/functions/data-caching/delete-cache-value |
2b44928ae11f-0 | Increment Cache Value allows you create an Incremental Cache Value by choosing a key and choosing the value to increment by. The incremented value is returned in a variable so you can perform logic based on what the count is. Key: set a key name. By: choose the value to increment by. Increment Cache Value can act as a lightweight counter. The incremental values are stored on temporary memory, so keep in mind, if the server were to ever restart then the count would be reset. Use case examples include a promotion where something is available or accessible for the first 100 users. Or perhaps, the 100th user wins the promotion. Previous Delete Cache Value Next Decrement Cache Value Last modified 3mo ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/functions/data-caching/increment-cache-value |
c45147dee729-0 | Decrement Cache Value allows you to decrement a cache value by choosing a key and a value to decrement it by. The decremented cache value is returned in a variable so you can perform additional logic based on its value. Key: create a key name for the decrement cache value. By: choose the value to decrement by. Decrement cache value is similar to increment cache value but it decreases the value. You can also use this as a counter stored on temporary memory. Previous Increment Cache Value Next Get Cache Keys Last modified 3mo ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/functions/data-caching/decrement-cache-value |
eb160de1de89-0 | Get Cache Keys allows you to retrieve cache keys that match a searched value. You can use "*" as a wildcard to search. Only putting in "*" will grab all keys but you can combine it with with text string to narrow your search. Search: enter in they name of the keys you are searching for. Use "*" as a wildcard. Here's an example of combining the wildcard "*" with text to retrieve cache key. Previous Decrement Cache Value Next Add to End of List Last modified 3mo ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/functions/data-caching/get-cache-keys |
5ef059938ba7-0 | Add to End of List allows you to insert a specified value at the tail end of the list, stored at the key you specify. Key: set a key name. Value: the value to add to the end of the list Previous Get Cache Keys Next Add to Beginning of List Last modified 11mo ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/functions/data-caching/add-to-end-of-list |
07e1cd7dca89-0 | Add to Beginning of List allows you to insert a value at the start of the list stored at a key you specify. Key: set a key name. Value: the value to add to the beginning of the list. Previous Add to End of List Next Remove From End of List Last modified 11mo ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/functions/data-caching/add-to-beginning-of-list |
da4fb5c6e93e-0 | Allows you to remove the last element from a list stored at a key you specify. Key: the key that you'd like to remove the value from Previous Add to Beginning of List Next Remove From Beginning of List Last modified 11mo ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/functions/data-caching/remove-from-end-of-list |
4c56ff4ce4aa-0 | Allows you to remove the first element from a list stored at a key you specify. Key: the key that you'd like to remove the value from Previous Remove From End of List Next Remove From List Last modified 11mo ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/functions/data-caching/remove-from-beginning-of-list |
a0a080f42e6f-0 | Allows you to remove a specified item from a list. You can choose to remove all specified values, or a maximum amount. Key: the key that you'd like to remove the value from Value: the value you would like to remove Count: the amount of values you want to remove. The default (0) will remove all, or you can specify a maximum. Previous Remove From Beginning of List Next Get Length of List Last modified 11mo ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/functions/data-caching/remove-from-list |
202cb962ac59-0 | Allows you to return the current length of a list as a variable. Key: specifies the key you would like to reference Previous Remove From List Next Get Elements From List Last modified 11mo ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/functions/data-caching/get-length-of-list |
c8ffe9a587b1-0 | Allows you to retrieve a range of values from a list. Key: specify which key you would like to reference. Start: identifies the start of the elements you would like to retrieve. Stop: identifies the end of the elements you would like to retrieve. You can use negative values to represent the end of the list (ex. -1 is the last element, -2 is the second to last, and so on). The start and stop parameters are also inclusive. This means that the results you are given will include the elements at the positions you start and end with. Previous Get Length of List Next Rate Limit Last modified 11mo ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/functions/data-caching/get-elements-from-list |
3def184ad8f4-0 | Xano allows you to set rate limits on your queries so that you can limit the requests per given time period that an API endpoint can be called. The Rate Limit function comes with a few settings for configuration. Key: define a key for the rate limit. Max: set the max amount of requests allowed in the given time or TTL. TTL: set the time to live, in seconds, of each cycle. Error: optionally include an error message. If you include an error message, when the Rate Limit is reached it will automatically throw an error and display this message. If you do not, the Rate Limit will output a boolean of false when the Rate Limit is reached. This can be used if you wish to create custom logic for what happens when the Rate Limit is reached. Previous Get Elements From List Next Custom Functions Last modified 3mo ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/functions/data-caching/rate-limit |
069059b7ef84-0 | These are Functions that are created and displayed in the Library or installed from the Marketplace. Custom Functions enabled you to build your own functions using the same workflow as the No Code API Builder. Just like the No Code API Builder, custom functions have inputs, the function stack, and the response. However, instead of an API endpoint URL, custom functions can be inserted into function stacks anywhere in your Xano workspace (API endpoints, other custom functions, or background tasks). Once you create a custom function from the library, you can insert it into any function stack when you select custom functions when adding a new function. If there are any inputs, you will need to map them for the function to run.
Link to YouTube Video: https://www.youtube.com/watch?v=Vg6Yp4GQIwo Building a custom function is just like building an API Endpoint. Custom functions have the same workflow as the No Code API Builder. Once you have created a custom function, you can add it to any function stack in your workspace by selecting Custom Functions when adding a function stack item. Once selected, you can choose from any of the custom functions in your workspace. Select any custom function in your workspace to add to a function stack. Previous Rate Limit Next Utility Functions Last modified 3mo ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/functions/custom-functions |
ec5decca5ed3-0 | 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 execution of the function stack for a period of time. Get All Input - Used for Webhooks Get All Environment Variables - Pull all environment variables into a single object Calculate Distance - Map the latitude 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.
Link to YouTube Video: https://www.youtube.com/watch?v=Gf6LxXfPiok Set conditions that must be true If not met, the request will stop. You can also specify an error message below. Error Type API Status Code Standard 500 (Internal Server Error) Not Found 404 (Not Found) Access Denied 403 (Forbidden) Too Many Requests 429 (Too Many Requests) Unauthorized 401 (Unauthorized) Bad Request 400 (Bad Request) 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. Get All Environment Variables The Get All Environment Variables function This function will gather all environment variables of your workspace and populate a single object with them. This allows you to more quickly access your environment variables using the GET filter, instead of manually populating them where they are needed elsewhere in your function stack. In this example, we have 3 environment variables in our workspace. By using Get All Environment Variables, we can populate all of these in a single variable for easier access. We can then use the GET filter to access each variable. For this example, we are populating a URL parameter for an API request. 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. Previous Custom Functions Next Content Upload Last modified 1mo ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/functions/utility-functions |
76dc611d6eba-0 | Upload Images, Videos, Audio, and Attachments
Link to YouTube Video: https://www.youtube.com/watch?v=e-dOGGF55mw&feature=youtu.be Xano allows for a wide range of files to get uploaded using the API.
There are 3 different categories of files that can be processed: Images, Videos, and Attachments.
(Note: Audio files such as mp3 should be treated as Attachments).
There is a generic file uploader that can be used as an input for your API to create the metadata for each category.
The Content Upload Functions are: Create Image Metadata - Creates image metadata from a file resource so that it can be formatted properly to be stored in Xano.
Create Video Metadata - Creates video metadata from a file resource so that it can be formatted properly to be stored in Xano.
Create Attachment Metadata - Creates attachment metadata from a file resource so that it can be formatted properly to be stored in Xano.
Create File Resource - This functions is able to create a file resource in the function stack from a variable.
Typically, you will use a file resource as an input.
However, there are certain use cases, for example, where you may hit an external API which is providing you with a raw image or file.
In this event, you will want to first use this function to create a file resource then use one of the create metadata functions.
Important - Inputting Content It's important to understand how content upload works through the API in Xano.
Watching the tutorial at the top of this page is encouraged.
**When uploading content (i.e.
image, video, or attachment), the content must be inputted as an input type of file resource** Use the input type file resource to upload images, videos, or attachments.
Notice the difference of what the inputs look like, for example with image metadata input versus file resource: File resource is the correct input type to upload an image.
Image (metadata) is incorrect.
Xano accepts base64 encoded files, URLs, or files uploaded directly in the debugger.
The file upload feature in the debugger Typically, front-end tools will produce an image URL which you can use to upload the image to Xano through the file resource input type.
This is common but each front-end is different so be sure to reference their documentation.
Function: Create File Resource
This function can create a file resource in the function stack from a variable.
You will want to use this function if you are working with an external API that is returning an image and you want to be able to store it in the Xano database.
You still must create the image metadata like you would if you were using an input of file resource to upload an image.
Note: While the File Resource input will accept base64 encoded imaegs, the Create File Resource function will not accept a base64 encoded image; this will have to be a decoded image.
Example - Upload an Image Xano has convenient, pre-built API endpoints that you can use or reference if you are doing content upload.
If you select 'Add API Endpoint' to create a new API Endpoint, you will see the 'Content Upload' option.
Add a new API Endpoint that is Content Upload.
Then you will have the option to choose from image, video, or attachment upload.
Choose the type of content you are uploading.
The API Endpoint will be set up with a file resource input type and a Create Image From File function.
The pre-built upload image API endpoint.
The function, Create Image From File will create the image metadata from the value of the file resource input as shown below.
Create the content metadata from the file resource input.
The file resource input can handle: URL of the content.
Base64 encoded file. | https://docs.xano.com/working-with-data/functions/content-upload |
76dc611d6eba-1 | The file itself Upload using the file picker Upload an Image URL or base64 Encoded File: Below we have the same API endpoint set up: The input type is a file resource and the function is creating the metadata.
In this example, we are inputting the image URL directly into the Debugger.
Since the debugger uses a file picker by default, we must manually write the input into the Debugger.
The result will show the image metadata for the inputted image: A successful response with the newly created image metadata.
Example using File Uploader through Swagger Click on Documentation and to try out the API in Swagger.
Find the API.
Click on "try it out".
Upload an image.
Click "execute".
Using Swagger to upload an image.
After uploading an image, this is the Metadata response from the "create image" API.
The response, in Swagger, of the newly created image metadata.
Adding an Image to the Database There is an additional step needed to add the image to the Xano database.
You must include an Add Record function after the Create Image Metadata function.
Make sure to map the image field to the result of the Create Image from File return variable.
After inputting an image and running the API endpoint the result will be shown below.
A newly created record with an uploaded image through the API.
Xano will output the image URL for convenience.
Content Upload Limitations Most file types are allowed, except for executable files.
File size limit is currently 64MB on the Build plan, 128MB on Launch, and 2GB on Scale.
Previous Utility Functions Next External API Request Last modified 1mo ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/functions/content-upload |
d1f491a404d6-0 | The external API request function allows you to access and process an external API endpoint from 3rd party services.
This enables your backend to interact with other APIs, which can be integrations with other SaaS products or any other custom APIs.
Link to YouTube Video: https://www.youtube.com/watch?v=_jEH41KOZos Typically, the external API that you wish to interact with will come with API documentation from the provider.
It is paramount that you read and understand the provided API documentation because this will explain how to set up and call the API endpoint successfully.
The more you familiarize yourself with APIs from different providers, the more you will see that each requires a different and specific set up (parameters, schema, methods, headers, authentication, etc.).
There are several parts to the external API request function: Import CURL: Allows you to import the cURL command of an external API endpoint.
Xano can automatically build the API request when the cURL command is imported.
URL: is the request URL of the API endpoint.
(example: https://api.example.com/v1/) Method: the verb that is used for the endpoint (GET, POST, PUT, DELETE, etc.)
Params: are the parameters that are passed into the API, these can be Path parameters or Query parameters.
Headers: are the parameters that allow you to define custom request headers.
Timeout: How long should Xano wait in seconds for a response before considering the request timed out.
The default is 10, but you can adjust this as needed depending on the external API you are calling.
The maximum time supported is one hour, or 3600 seconds.
Follow_location: determines if you wish to automatically follow the redirects (if there are any) in the API call.
(An example of this would be an API that generates a file for you, then gives you a redirect to get that file.
Google does this when turning a spreadsheet into a CSV).
The external API request function has several different parts to it.
Building an external API request: two ways Import CURL The Import CURL button is a powerful tool that helps save a huge amount of time when creating external API requests.
Often times, API documentation will provide a CURL command of the API call.
This can be copied and pasted into Xano to automatically build the formatted call to the external API.
In this example, we are going to use the public documentation of the Sendgrid API.
curl --request POST \ --url https://api.sendgrid.com/v3/mail/send \ --header 'Authorization: Bearer <<YOUR_API_KEY>>' \ --header 'Content-Type: application/json' \ --data '{"personalizations":[{"to":[{"email":"[email protected]","name":"John Doe"}],"subject":"Hello, World!
"}],"content": [{"type": "text/plain", "value": "Heya!
"}],"from":{"email":"[email protected]","name":"Sam Smith"},"reply_to":{"email":"[email protected]","name":"Sam Smith"}}' First, copy the curl command.
Then, open the external API request function in Xano and select the import curl button.
Paste in the curl command and select import.
The curl command is pasted in.
After importing the curl, Xano creates the external API request by programmatically exploding out the content.
The import curl functionality is a huge time saver by cutting down the time it would take to enter all this information in manually.
The import curl functionality saves a massive amount of time by not having to enter all the information manually.
With the quickly built API call to Sendgrid, we can now swap out any values we may need to with dynamic inputs or variables.
Manually Build an External API Request A curl command will not always be provided by the external service's API documentation.
Therefore, sometimes manually building the external API request is required.
Fortunately, Xano still makes this easy to do with the external API request function. | https://docs.xano.com/working-with-data/functions/external-api-request |
d1f491a404d6-1 | To examine this, let's breakdown each component of the function: URL: is the request URL of the API endpoint.
(example: https://api.example.com/v1/) The API endpoint URL goes directly in the input box as text.
Filters are also available in case you need to add any text or data manipulation to the URL.
(Commonly used ones include sprintf, concat, url_addarg).
The API endpoint URL goes directly into the input box Method: the verb that is used for the endpoint (GET, POST, PUT, DELETE, etc.)
Open the drop down selector to choose from all the potential method values for an API call.
They include: GET, POST, PUT, DELETE, HEAD, OPTIONS, and PATCH.
Use the drop down to select which method to use for the external API call.
Params: are the parameters that are passed into the API, these can be Path parameters or Query parameters.
Parameters are typically defined with a key value pairing.
Notice that the data type is defaulted to an object.
You can use the quick filter SET to build the path or key and add the related value.
(Note: values can often be dynamic with inputs or variables).
Note: When referencing the API documentation of the provider pay attention to if they define acceptable values for each parameter.
SET allows you to quickly add a parameter.
The SET filter: The path would be considered the parameter name or key.
The value is the value.
If provided a request body, you can use the IMPORT JSON functionality to paste the request body into the parameter section and import it.
This will work similarly to import curl but is used for just the request body.
You can either open the drop down and find the import JSON option or paste the request body directly in the input box and Xano will detect it is JSON - from there you can select import.
Import JSON is an easy way to create the parameters if the request body is provided.
Headers: are the parameters that allow you to define custom request headers.
External APIs may often require headers according to the provider's API documentation.
Often times, these may include different authentication methods where you may be required to define an API key or API secret that you receive from the external service.
To define a header, you can use the quick filter PUSH.
Use the quick filter PUSH to define a header.
The PUSH filter: Add the header directly into the value section.
Follow_location: determines if you wish to automatically follow the redirects (if there are any) in the API call.
Follow_location has two potential values: True - if you want to automatically follow any redirects from the API call.
False- if you do not want to follow any redirects from the API call.
Choose either a true boolean or false boolean.
Multipart Support Xano has support for sending images through the external API request function.
You can send a file resource - either as an input or variable - through the parameters section of the external API request as a key-value pair or as the entire parameter (depending on what the specific API requires).
Below is an example of sending an image as a key-value pair parameter to an external API.
In this example, the image is being passed as a file resource input.
They parameter key is named content and the value is the input.
An example of passing an image as a parameter to an external API.
Another example shows the file resource being created from a variable then being used in the parameters section.
In this example, the file resource is created from a variable.
In this last example, this particular external API requires the image to be sent as the entire parameter - versus in a key-value format.
Below the file resource is created from a variable and the return variable is inserted into the params sections.
In this example, the image is sent as the entire parameter to the external API.
Calling a GraphQL API in Xano | https://docs.xano.com/working-with-data/functions/external-api-request |
d1f491a404d6-2 | Link to YouTube Video: https://www.youtube.com/watch?v=n_uXzLN-ctc Previous Content Upload Next - Working with data Filters Last modified 9mo ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/functions/external-api-request |
9b8619251a19-0 | Filters are used to transform data in Xano. Filters are the primary way that data gets transformed in the Function Stack. They can be used with inputs or data as they get processed through the function stack.
Link to YouTube Video: https://www.youtube.com/watch?v=bFNtoQhMJ_E For example, if you wanted to transform text you were receiving from the front-end to be all caps you can use the to_upper filter and it would change all lower case letters to upper case. Filter Types Math Timestamp Array Conversion Comparison Text Cryptography Manipulation Previous External API Request Next Math Filters Last modified 1yr ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/data-type-filters |
1afa34a7f984-0 | Link to YouTube Video: https://www.youtube.com/watch?v=OJtsO-R9VBI Math filters are various operations in Xano to perform math and calculations. Like all filters you can chain math filters together and nest them inside one another to perform order of operations. abs - Returns the absolute. acos - Calculates the arc cosine of the supplied value in radians. acosh - Calculates the inverse hyperbolic cosine of the supplied value in radians. add - Add 2 values together and return the answer asin - Calculates the arc sine of the supplied value in radians.. asinh - Calculates the inverse hyperbolic sine of the supplied value in radians. atan - Calculates the arc tangent of the supplied value in radians. atanh - Calculates the inverse hyperbolic tangent of the supplied value in radians. bitwise_and - Bitwise AND 2 values together and return the answer. bitwise_or - Bitwise OR 2 values together and return the answer. bitwise_xor - Bitwise XOR 2 values together and return the answer. ceil - Round a decimal up to its integer equivalent. cos - Calculates the cosine of the supplied value in radians. deg2rad - Convert degrees to radians. divide - Divide 2 values together and return the answer. exp - Returns the exponent of mathematical expression "e". floor - Round a decimal down to its integer equivalent. array_max - Returns the max of the values of the array. array_min - Returns the min of the values of the array. modulus- Modulus 2 values together and return the answer. min - Return the min of any two values max - Return the max of any two values multiply - Multiply 2 values together and return the answer. number_format - Format a number with flexible support over decimal places, thousands separator, and decimal separator. pow - Returns the value raised to the power of exp. product - Returns the product of the values of the array. rad2deg - Convert radians to degrees. round - Round a decimal with optional precision. sin - Calculates the sine of the supplied value in radians. sqrt - Returns the square root of the value subtract - Subtract 2 values together and return the answer. sum - Returns the sum of the values of the array. tan - Calculates the tangent of the supplied value in radians. abs(x) acos(x) acosh(x) add(x, y) asin(x) asinh(x) atan(x) atanh(x) bitwise_and(x, y) bitwise_or(x, y) bitwise_xor(x, y) ceil(x) cos(x) deg2rad(x) divide(x,y) exp(x) floor(x) min max modulus(x, y) multiply(x, y) number_format(x, decimals, decimalpoint, separator) pow(x, exp) rad2deg(x) round(x, precision) sin(x) sqrt(x) subtract(x, y) tan(x) Special Array Math Filters: array_max array_min Product Sum Working with data - Previous Filters Next Timestamp Filters Last modified 1mo ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/data-type-filters/math-filters |
65ded5353c5e-0 | A timestamp is a sequence of characters or encoded information identifying when a certain event occurred. For information on how Xano stores, reads, and formats timestamps visit the Timestamp page. to_timestamp:
In this example, the timezone UTC is important because 'last Monday' means different things depending on timezone.
It's important to specify a timezone for 'last Monday' because it could 'last Monday' at 00:00:00 PST is different than 'last Monday at 00:00:00 UTC (or any other timezone). Xano stores it in Unix timestamps which is a specific number in milliseconds. However, if the timezone was present like in this example, then the timezone would not have any effect.
In this example 'now' would be the same Unix timestamp, regardless of timezone. Therefore, a specified timezone like UTC, is not necessary. add_ms_to_timestamp:
Add milliseconds to a timestamp, (negative values are ok). This filter will change the timestamp from 1593046644 to 1593546644. add_secs_to_timestamp:
Add seconds to a timestamp, (negative values are ok). This filter will change the timestamp from 1593046644 to 1593546644. format_timestamp:
Converts a timestamp into a human-readable formatted date based on the supplied format. This format follows this PHP DateTime format list. M is month like Jul, Y is year, etc.
Timezone regions are listed here. The “r” format displays the entire date including timezone offset. America/Los_Angeles timezone will have an offset for that timezone. The result would look like: Mon, 09 Nov 2020 17:28:05 -0800 This filter will convert the Unix timestamp to 2020-07-02 16:14:25 using the Y-m-d H:i:s format. parse_timestamp:
Parse a timestamp from a flexible, human-readable format into a Unix timestamp in milliseconds. This filter is sort of like the opposite of format_timestamp. You can utilize the PHP DateTime Format character list to transform a time format into a Unix timestamp in milliseconds. In this example, May 4th, 2020 is transformed into a timestamp. Parse format for May 4th, 2020 F jS, Y 30/03/2024 14:30:00 is parsed into a Unix timestamp in milliseconds Parse format for 30/03/2024 14:30:00 d/m/Y H:i:s 11-27-22 5:15PM is parsed into a Unix timestamp in milliseconds. Parse format for 11-27-22 5:15PM m-d-y g:iA 6/1/22 07:30:00 am will be parsed into a Unix timestamp in milliseconds. Parse format for 6/1/22 07:30:00 am n/j/y h:i:s a transform_timestamp:
This allows you to use relative time formats that are anchored around a previous time. Use the link to see various relative time formats that Xano accepts. This example is saying last Monday of PST, at the start of the day (00:00:00) Previous Math Filters Next Array Filters Last modified 1yr ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/data-type-filters/timestamp-filters |
9fc3d7152ba9-0 | Append:
Push an element on to the end of an Array within an object and return the updated object.
In this example, we have an Array of [ 1,2,2,1 ] by using the append filter the variable becomes [ 1,2,2,1,100].
Join:
Joins an array into a text string via the seperator and returns the result
In the below example, we have an array of [ 1,2,3,4 ] and we use the join filter with the text :hello:
The variable becomes 1:hello:2:hello:3:hello:4 Count:
Return the number of items of an Array.
In this example, we have an Array of [ 1,2,2,1 ] by using the count filter the variable becomes 4. filter_empty:
Returns a new Array with only entries that are not empty ("", null, 0, []).
In this example, we have an Array of [ 1,2,,2,1 ] by using the filter_empty the variable becomes [ 1,2,2,1 ].
first:
Get the first entry of an Array.
In this example, we have an Array of [ 1,2,0,2,1 ] by using the first filter the variable becomes 1. last:
Get the last entry of an Array.
In this example, we have an Array of [ 1,2,0,2 ] by using the last filter the variable becomes 2. merge:
Merge the first level of elements of both Arrays together and return the new array.
Example: we have an Array of [ 1,2,0,2,1 ] by using the merge filter the variable becomes [1, 2, 0, 2, 1, "123"].
merge_recursive:
Merge the elements from all levels of both Arrays together and return the new Array.
We will set up our first array as var_1 using this JSON: { "a": "test", "b": ["a","b"] } We will set up our second array as var_2 using this JSON: { "c": "hi", "b": ["c","d"] } We will then set up our filter as follows: var_3 would then become: { "a": "test", "b": ["a",b","c","d"] }{ "c": "hi", } pop:
Pops the last element of the Array off and returns it.
In this example, we have an Array of [ 1,2,0,2,1 ] by using the pop filter the variable becomes 1. prepend:
Push an element on to the beginning of an Array within an object and return the updated object.
In this example, we have an Array of [ 1,2,0,2,1 ] using the prepend filter the variable becomes [ 23,1,2,0,2,1].
push:
Push an element on to the end of an Array within an object and return the updated object.
In this example, we are using the push filter to create the Array [1, 2, 0, 2, 1].
range:
Returns array of values between the specified start/stop. | https://docs.xano.com/working-with-data/data-type-filters/array-filter |
9fc3d7152ba9-1 | In this example we have an array [1,2,3,4,5 ] and we are using the filter range with the values of start: 2 and stop 4, this returns the array of [2,3,4] remove:
Remove any elements from the array that match the supplied value and return the new array
In this example we have an array [1,2,3,4,5,6] After we apply the remove filter with the value of 3 the array becomes: [1,2,4,5,6] Let's change the array to a more complex one:
[ { "name":"Ford"}, { "name":"GM" }, { "name":"Chevrolet" } ]
In this example we will need to specify the path.
After we apply the remove filter the array becomes: [ { "name":"GM" }, { "name":"Chevrolet" } ] shift:
Shifts the first element of the Array and returns it.
In this example, we have an Array of [ 1,2,0,2,1 ] by using the shift filter the variable becomes 1. sort:
Sort an Array of elements with an optional path inside the element, sort type, and ascending/descending.
Sort types include: text - case-sensitive sort for text itext - case-insensitive sort for text number - to sort numerically natural - case-sensitive sort that is alphanumerical and natural to humans inatural - case-insensitive sort that is alphanumerical and natural to humans Ascending order is performed with a true boolean.
Descending order uses a false boolean.
The example below shows the difference between case-sensitivity sort with text and itext: In this example, the Array is being sorted by text type in ascending order.
The result is the Array sorted by text alphabetically and case-sensitive.
In this example, the sort type is now itext, which is case-insensitive.
Here is the result of the Array sorted with itext.
Notice the difference case-sensitivity makes.
The example below shows how to use the number sort type: In this example, we are sorting numerically in ascending order (or lowest to highest).
Here we can see the result of the Array when sorted using the number type.
The example below shows the difference in sorting between natural and number when dealing with alphanumeric values: In this example, the sort type is natural in ascending order.
The response is the Array sorted in a order that is natural to humans.
In this example, the Array is sorted numerically in ascending order.
Here the Array is sorted numerically.
Notice the difference between natural and numeric sort with alphanumeric values.
unique:
Returns unique values of an Array.
You can also use this filter with an array of objects by specifying a path to the key you would like to use to judge uniqueness.
In this example, we have an Array of [ 1,2,0,2,1 ] using the unique filter the variable becomes [ 1,2,0].
unshift:
Push an element to the beginning of an Array and return the new Array.
In this example, we have an Array of [ 1,2,0,2,1 ] using the unshift filter the variable becomes [ 58,1,2,0,2,1].
Previous Timestamp Filters Next Conversion Filters Last modified 5mo ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/data-type-filters/array-filter |
02522a2b2726-0 | base64_decode: Decodes the value represented as base64 and returns the result.
Example: we have a text value of aGVsbG8gd29ybGQ= using the filter base64_decode we get hello world.
base64_decode_urlsafe: Decodes the value represented as base64 URL safe text and returns the result.
This filter transforms the base64 URL safe encoded characters -_. back to +/=.
base64_encode: Encodes the value and returns the result as base64 text.
Example: we have a text value of hello world using the filter base64_encode we get aGVsbG8gd29ybGQ= .
base64_encode_urlsafe: Encodes the value and returns the result as base64 URL safe text.
In base64 encoding, a URL safe format is not taken into consideration but there's only three characters we need to be cautious of +/=.
With this filter those characters become -_. respectively.
base_convert: Converts a value between two bases.
frombase:
Required.
Specifies the original base of number.
Has to be between 2 and 36, inclusive.
Digits in numbers with a base higher than 10 will be represented with the letters a-z, with a meaning 10, b meaning 11 and z meaning 35
tobase:
Required.
Specifies the base to convert to.
Has to be between 2 and 36, inclusive.
Digits in numbers with a base higher than 10 will be represented with the letters a-z, with a meaning 10, b meaning 11 and z meaning 35
In this example we are converting a hexadecimal number to an octal number: In this example, the variable var_1 becomes: 160626. bin2hex: Converts a binary value into its hex equivalent.
In this example, the variable var_1 becomes: 31303130. decbin: Converts a decimal value into its binary string (i.e.
01010) equivalent.
In this example, the variable var_1 becomes: 111110100. bindec: Converts a binary string (i.e.
01010) into its decimal equivalent.
In this example, the variable var_1 becomes: 10. create_object: Creates an object based on a list of keys and a list of values.
Keys list is [first_name, company, position].
Values list is [Michael, Xano, Customer Success Lead].
Resulting in a created object: The lists of keys and values are combined to create an object.
dechex: Converts a decimal value into its hex equivalent.
In this example, the variable var_1 becomes: 31303130. decoct:
Converts a decimal value into its octal equivalent.
In this example, the variable var_1 becomes: 12. hex2bin: Converts a hex value into its binary equivalent.
In this example, the variable var_1 becomes: 1010. hexdec: Converts a hex value into its decimal equivalent.
In this example, the variable var_1 becomes: 825241904. json_decode: Decodes the value represented as json and returns the result.
We will decode the json from the json_encode filter example.
In this example, the variable json2 becomes: { "a":"3", "b":"2", "c":"1" }.
json_encode: Encodes the value and returns the result as json text.
The variable object is: { "a":"3", "b":"2", "c":"1" }.
In this example, the variable json becomes: {\"a\":\"3\",\"b\":\"2\",\"c\":\"1\"}.
octdec: Converts an octal value into its decimal equivalent.
In this example, the variable var_1 becomes: 33498. to_bool: Converts text, integer, or decimal types to a bool and returns the result. | https://docs.xano.com/working-with-data/data-type-filters/conversion-filters |
02522a2b2726-1 | The different conversions that are possible with this filter are:
Converting a text/integer/decimal value of 0 to false.
Converting a text/integer/decimal value of 1 to true.
Converting a text value of "true" to true.
Converting a text value of "false" to false.
Example: we have a text value of 0 by using the to_bool filter the variable becomes false.
to_decimal: Converts text, integer, or bool types to a decimal and returns the result.
Example: we have a text value of 5.76 by using the to_decimal filter the variable becomes a dec= 5.76. to_int: Converts text, decimal, or bool types to an integer and returns the result.
Example: we have a text value of 5.76 by using the to_int filter the variable becomes an int= 5 to_text: Converts text, decimal, or bool types to text and returns the result.
Example: we have a decimal value of 5.76 by using the to_text filter the variable becomes a text= 5.76 to_timestamp: Converts a text expression (now, next Friday) to timestamp comparable format.
Example: we have a text value of now by using the to_timestamp filter the variable becomes 1593204483394. url_decode: Decodes the value represented as a URL encoded value.
Example: we have a text value then use the url_decode filter to change it to Hello World & Xano.
url_encode: Encodes the value and returns the result as a URL encoded value.
Example: we have a text value then use the url_encode filter to change it to Hello+World+%26+Xano.
yaml_decode: Decodes the value represented as yaml and returns the result.
For this example, we will use the example from yaml encode and then decode the variable.
The variable gets changed into: { "name": "John", "age": 30, "car": "ford" } yaml_encode: Encodes the value and returns the result as yaml text.
This returns the variable as name: John age: 30 car: ford Previous Array Filters Next Text Filters Last modified 1yr ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/data-type-filters/conversion-filters |
7f1de29e6da1-0 | Link to YouTube Video: https://www.youtube.com/watch?v=b45bQw5XFQs Text filters enable you to transform and manipulate text.
capitalize - Converts the first letter of each word to a capital letter.
concat - Concatenates two values together.
contains - Returns whether or not the expression is found.
convert_encoding - Converts a text element's encoding to another detect_encoding - Returns the encoding of a text element ends_with - Returns whether or not the expression is present at the end.
icontains - Returns whether or not the case-insensitive expression is found.
iends_with - Returns whether or not the case-insensitive expression is present at the end.
iindex - Returns the index of the case-insensitive expression or false if it can't be found.
index - Returns the index of the case-sensitive expression or false if it can't be found.
istarts_with - Returns whether or not the case-insensitive expression is present at the beginning.
list_encodings - Returns available encoding formats for convert_encoding and detect_encoding ltrim - Trim whitespace or other characters from the left side and return the result.
querystring_parse - Parses a query string from a URL into its individual key-value pairs.
regex_get_all_matches - Return all matches performed by a regular expression on the supplied subject text.
regex_get_first_match - Return the first set of matches performed by a regular expression on the supplied subject text.
regex_matches - Tests if a regular expression matches the supplied subject text.
regex_quote - Update the supplied text value to be properly escaped for regular expressions.
regex_replace - Perform a regular expression search and replace on the supplied subject text.
replace - Replace a text phrase with another.
rtrim - Trim whitespace or other characters from the right return the result.
split - Splits text into an array of text and returns the result.
sprintf - formats text with variable substitution.
starts_with - Returns whether or not the expression is present at the beginning.
strlen - Returns the number of characters.
substr - Extracts a section of text.
to_lower - Converts all characters to lower case and returns the result.
to_upper - Converts all characters to upper case and returns the result.
trim - Trim whitespace or other characters from both sides and return the result.
url_addarg - Parses a URL and returns an updated version with an encoded version of the supplied argument.
url_delarg - Parses a URL and returns an updated version with the supplied argument removed.
url_getarg - Gets the argument's value from a URL.
url_hasarg - Returns the existence of a argument in the URL.
strip_html - Parses through raw HTML and removes tags url_parse - Parses a URL into its individual components.
capitalize: Converts the first letter of each word to a capital letter.
Example: we have a text value of hello world and apply the capitalize filter and it becomes Hello World.
concat: Concatenates 2 text strings together by an optional separator.
The value can be any text and the separator can be anything: + , -, _, a space, etc...
Example: we have a text value of hello world and apply the concat filter and it becomes hello world+Xano.
contains: Returns whether or not the expression is found and is case-sensitive.
The search term can be any string of text.
This returns a "true" or "false" response.
Example: we have a text value of hello world and apply the contains filter this returns a value of "true convert_encoding Converts an encoded text element from one type of encoding to another detect_encoding Detects the encoding of a text element.
Use the Encodings parameter to specify the encodings to check against, or leave blank to auto-detect ends_with: Returns whether or not the expression is present at the end.
The search term can be any string of text.
This returns a "true" or "false" response. | https://docs.xano.com/working-with-data/data-type-filters/text-filter |
7f1de29e6da1-1 | Example: we have a text value of hello world and apply the ends_with filter this returns a value of "false".
icontains: Returns whether or not the case-insensitive expression is found.
The search term can be any string of text.
This returns a "true" or "false" response.
Example: we have a text value of hello world and apply the icontains filter this returns a value of "false".
iends_with: Returns whether or not the case-insensitive expression is present at the end.
The search term can be any string of text.
This returns a "true" or "false" response.
Example: we have a text value of hello world and apply the iends_with filter this returns a value of "true".
iindex: Returns the index of the case-insensitive expression or false if it can't be found.
The search term can be any string of text.
This returns an integer value of where the character(s) exist in the string.
The first character in a text string has an index of 0.
Example: we have a text value of hello world and apply the iindex filter this returns a value of "6".
index: Returns the index of the case-sensitive expression or false if it can't be found.
The search term can be any string of text.
This returns an integer value of where the character(s) exist in the string.
The first character in a text string has an index of 0.
Example: we have a text value of hello world and apply the index filter this returns a value of "1".
istarts_with: Returns whether or not the case-insensitive expression is present at the beginning.
The search term can be any string of text.
This returns a "true" or "false" response.
Example: we have a text value of hello world and apply the istarts_with filter this returns a value of "true".
list_encodings Lists the available encodings for detect_encoding and convert_encoding ltrim: Trim whitespace or other characters from the left side and return the result.
The mask text can be any string of text.
Example: we have a text value of hello world and apply the ltrim filter this returns a value of "llo world".
rtrim: Trim whitespace or other characters from the right return the result.
The mask text can be any string of text.
Example: we have a text value of hello world and apply the ltrim filter this returns a value of "hello wo".
querystring_parse: Extracts query strings from a URL and places them into separate key/value pairs.
The example below separates a URL using the url_parse filter, and then uses querystring_parse to parse the query parameters into separate keys and values.
The test URL The function and querystring_parse filter The result join: Joins an array of text into text via the separator and returns the result.
Theseperator text can be any string of text.
The array in this example is:
[ hello, world, how, are, you] Example: we have an array of text and we apply the join filter with the seperator "?"
this returns: hello?world?how?are?you Regex (Regular Expression) Regex or regular expression is a more advance topic that can be useful for finding patterns in text.
It is a string of text that allows you to create patterns that help match, locate, and manage text.
Regex typically includes something called delimiters to set the boundaries of the expression.
Often times, / will be used as delimiters but almost any character can be used.
Regex filters inside the Query All Records function do not use delimiters.
Regex filters in any other variable, function, etc.
in Xano require delimiters.
Regex uses special characters, for example: . | https://docs.xano.com/working-with-data/data-type-filters/text-filter |
7f1de29e6da1-2 | is any character \d is any number \s is any whitespace \w is any word character * means 0 or more + means 1 or more Regex uses additional special characters, these are just to name a few as an example.
Some special characters need the \ escape character, which is why regex_quote can be useful to determine this.
For example, .
and $ do but @ does not.
You can then use ( ) to group matches.
For example: /(\w+)@\w+\.\w+/ this would get name of and full email address / is the starting delimiter (\w+) is a matching group, this group must be at least 1 or more word character @ is the symbold @ \w+ is at least 1 or more word character \.
is the symbol .
\w+ is at least 1 or more word character / is the ending delimiter regex_get_all_matches: Return all matches performed by a regular expression on the supplied subject text.
In this example, we are searching for all matches of /you/ which will return two matches [you, you].
regex_get_first_match: Return the first set of matches performed by a regular expression on the supplied subject text.
In this example, we are searching for the phrase h with one more additional word characters.
The result is how and not Hi because this is case-sensitive.
regex_matches: Tests if a regular expression matches the supplied subject text.
Returns a true or false boolean.
In this example, we are seeing if the subject matches the provided regex.
The result will be true because how matches /h\w+/ which is a string starting with h and having one or more word characters after.
regex_quote: Update the supplied text value to be properly escaped for regular expressions.
The result using / as a delimiter.
regex_replace Perform a regular expression search and replace on the supplied subject text.
In this example, we are using /(\w+)@\w+\.\w+/ to find an email address and using the replacement to replace it with [email protected].
The result is please email [email protected] replace: Replace a text phrase with another.
Search can be any word in the value and the replacement can be anything.
Example: we have a text value of hello world and apply the replace filter and it becomes hello Xano.
split: Splits text into an array of text and returns the result.
The separator can be anything the words are separated by, in this example, it is the + symbol.
Example: we have a text value of hello+world and apply the split filter and it becomes ["hello", "world"].
Split and trim text into an array example We can combine multiple filters to format a text string into an array.
For example, we have the string "a , b,c, d" Notice the inconsistent spaces.
If all we do is use split then the spaces will persist in the array.
We can combine trim and filter_empty filters to remove unnecessary spaces or blank values.
sprintf Formats text with variable substitution.
This is helpful when wanting to substitute a URL string with a variable that either the use provides or that is gotten from the result of a previous function.
- %d is used to replace a number and will enforce a number.
- %s is used to replace text.
The first example shows how to use variable substitution with a number using %d.
Example: we have a text value of hello world %d and apply the sprintf filter, it becomes hello world 54321.
The second example will replace %s with text: Example: we have a text value of hello world %s and apply the sprintf filter, it becomes hello world anything.
We can use multiple arguments on the sprintf filter to replace any number of values.
In the example below we have 2 %d and 2 %s.
The first %d is equivalent to the first argument of 123. | https://docs.xano.com/working-with-data/data-type-filters/text-filter |
7f1de29e6da1-3 | The second %d is equivalent to the second argument of 789.
The first %s is equivalent to the first argument of hi.
The first %s is equivalent to the second argument of end.
This example becomes: 123 hello 789 world hi this is the end starts_with: Returns whether or not the expression is present at the beginning.
The search term can be any string of text and is case-sensitive.
This returns a "true" or "false" response.
Example: we have a text value of hello world and apply the starts_with filter this returns a value of "false".
strlen: Returns the number of characters.
Example: we have a text value of hello world and apply the strlen filter and it becomes the int 11. strip_accents Removes accents from characters substr: Extracts a section of text.
The start pos is based on the # of characters from the beginning with the first char pos= 0.
The length can be an int.
Example: we have a text value of hello world and apply the substr filter and it becomes wo.
to_lower Converts all characters to lower case and returns the result.
Example: we have a text value of HeLLo WoRlD and apply the to_lower filter and it becomes hello world.
to_upper: Converts all characters to upper case and returns the result.
Example: we have a text value of HeLLo WoRlD and apply the to_upper filter and it becomes HELLO WORLD.
trim: Trim whitespace or other characters from both sides and return the result.
The mask text can be any string of text.
Example: we have a text value of ?
!hello world?!
and apply the trim filter this returns a value of "hello world".
url_addarg: Parses a URL and returns an updated version with an encoded version of the supplied parameter.
This filter is used to add a key(blog_id, authorname) and a value (123 , john).
Those parameters would be added as ?blog_id=123 and ?authorname=john.
This URL becomes https://www.xano.com/?user_id=1 after the filter is applied url_delarg: Parses a URL and returns an updated version with the supplied parameter removed.
This filter is used to delete a key(blog_id, authorname).
Those parameters would be deleted at the end of a url as ?blog_id or ?authorname.
This URL becomes https://www.xano.com/ after the filter is applied url_getarg: Returns the value of a query parameter in a URL.
Our sample URL In this example, we are getting the value of the "another" query parameter.
url_hasarg: Returns the existence of an arguments in the URL.
The result of this filter will be true because the argument test strip_html: Parses raw HTML and removes HTML tags, returning the remaining text.
For example, if you input HTML that contains a collection of <p> tags and want to remove these and only return the text.
Good to use in succession with the split filter to parse several elements and separate them into an array.
In this example, we are stripping the tags from an HTML paragraph and returning the result.
url_parse: Parses a URL into its individual components.
The result of this filter will parse the URL into its individual components.
In this example, the filter parses the URL into its individual components.
Previous Conversion Filters Next Security Filters Last modified 25d ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/data-type-filters/text-filter |
42a0e188f503-0 | create_uid:
Returns a unique 64bit unsigned int value seeded off the value. In this example, the variable crypto becomes 3612171568446766000. decrypt: Decrypts the value and returns the result. encrypt: Encrypts the value and returns the result in raw binary form. Find more details on the encrypt function page. hmac_md5:
Returns a MD5 signature representation of the value using a shared secret via the HMAC method.
The secret key is a unique piece of information that is used to compute the HMAC and is known both by the sender and the receiver of the message. This key will vary in length depending on the algorithm that you use. In this example, the variable var_1 becomes 0ea035295cb4a89735c302776b3689446bf2d7af. hmac_sha1:
Returns a SHA1 signature representation of the value using a shared secret via the HMAC method.
The secret key is a unique piece of information that is used to compute the HMAC and is known both by the sender and the receiver of the message. This key will vary in length depending on the algorithm that you use. In this example, the variable var_1 becomes 0ea035295cb4a89735c302776b3689446bf2d7af. hmac_sha256:
Returns a SHA256 signature representation of the value using a shared secret via the HMAC method.
The secret key is a unique piece of information that is used to compute the HMAC and is known both by the sender and the receiver of the message. This key will vary in length depending on the algorithm that you use. In this example, the variable var_1 becomes 734aeac141e3a20937ccc918179b4e200f38ff58726432efb82717799d86c880. jwe_decode:
Decodes the value represented as JWE token and returns the original payload. In this example, we use the JWE token that was encoded below and decoded it back to 456. jwe_encode:
Encodes the value and returns the result as a JWE token. In this example, we use the jwe_encode filter and it returns a JWE token. md5:
Returns an MD5 signature representation of the value. A salt value can be added to the text to provide an extra layer of security. secureid_decode:
Returns the id of the original encode. If a salt was added to encode this value the same salt needs to be added to decrypt it. Example: the variable is the secureid_encode example with the secureid_decode filter, it becomes 123456. secureid_encode:
Returns an encrypted version of the id. A salt value can be added to the text to provide an extra layer of security. In this example, the variable is an integer 123456 with the secureid_encode filter it becomes QWd1cA.1NMF7ukY3mQ. sha1:
Returns a SHA1 signature representation of the value. A salt value can be added to the text to provide an extra layer of security. sha256:
Returns a SHA256 signature representation of the value. A salt value can be added to the text to provide an extra layer of security. Previous Text Filters Next Manipulation Filters Last modified 1yr ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/data-type-filters/crypto-filters |
3988c7f88ebc-0 | Conditional Set Filters first_notempty - returns the first value that is not empty first_notnull - returns the first value that is not null set_ifnotempty - Good for updating objects. set_ifnotnull - Similar to above, but useful for when you are dealing with null values. set_conditional - sets a value at a specified path based on a conditional For all examples of these filters we will use the same Object: {
"a":"1",
"b":"2",
"c":"3"
} coalesce
This is a special SQL filter for handling null values. It will provide an alternative value for null values. This may especially come in handy for sorting with joined data. It is only available on evals in the Query All Records function. In this example, coalesce is applied to this eval of merchant_id. This allows us to provide an alternative value for null, which in this case is defined as 0. The below example shows the query results when sorted in descending order by deal.merchant_id WITHOUT a coalesce filter applied. In this example, there is no coalesce filter and the null values will come first when sorting by descending order. And last when sorting by ascending order. With the coalesce filter applied, the null value takes on the substituted value. In this example, we applied the coalesce filter to make null values take a value of 0. Now, when we sort by descending order the previously null values come last because they take on the value of 0. entries
Get the property entries of an object as an array of key/value pairs. get
Returns the value of an object at the specified path, the path is the key of each pair, in this example, the path could be: a, b, or c. In this example, we apply the get filter with the path of a and the variable becomes 1. has
Returns the existence of whether or not something is present in the object at the specified path, the path is the key of each pair, in this example the path could be: a, b, or c. This filter returns a value of true or false. In this example, we apply the has filter with the path of c and the variable becomes true. keys
Get the property keys of an object as an Array. In this example, we apply the keys filter with the path of c and the variable becomes an array of [ "a", "b", "c"] set
Sets a value at the path within the object and returns the updated object. In this example, we use the set filter to create an object { "a":"1", "b":"2", "c":"3" }. unset
Removes a value at the path within the object and returns the updated object. In this example, we use the unset filter to create an object { "a":"1", "c":"3" }. values
Get the property values of an object as an Array: In this example, we apply the values filter with the path of c and the variable becomes an Array of [ "1", "2", "3"]. create_object_from_entries
Creates an object based on an array of key/value pairs. If you have an array of objects with key / value pairs, you can use this filter to consolidate them back into a single object. This can be useful if, for example, you are removing empty values from a list of key / value pairs, and then want them returned as a single object. Previous Security Filters Next Conditional Set Filters Last modified 8mo ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/data-type-filters/manipulation-filters |
013d407166ec-0 | These filters are helpful if you want update only certain fields in a given database record or object. Conditional filters are able to be used in place of Conditional (If-then-else) statements for certain use-cases. They will make your business logic appear much smoother and with less headache.They will be extremely helpful when editing a record but you only wish to update fields that are not empty or not null, in addition to updating objects where a field is not null or not empty. In basic terms, it's a way to say "if this field isn't update, then update it. But if it has an existing value then leave it alone"
Link to YouTube Video: https://www.youtube.com/watch?v=WvOlaXmoq5o Here are the examples: first_notempty - returns the first value that is not empty (example shown in the video above) first_notnull - returns the first value that is not null set_ifnotempty - Good for updating objects. (example shown 4m in the video above) set_ifnotnull - Similar to above, but useful for when you are dealing with null values. Previous Manipulation Filters Next Comparison Filters Last modified 1yr ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/data-type-filters/manipulation-filters/conditional-set-filters |
e00da03b685a-0 | Comparison filters are useful for comparisons and checking data types, especially for conditional logic.
They will result in a true or false boolean value.
bitwise_not - Returns the existing value with its bits flipped.
equals - Returns a boolean if both values are equal.
even - Returns whether or not the value is even.
greater_than - Returns a boolean if the left value is greater than the right value.
greater_than_or_equal - Returns a boolean if the left value is greater than or equal to the right value.
in - Returns whether or not the value is in the array.
is_array - Returns whether or not the value is a numerical indexed array.
is_bool - Returns whether or not the value is a boolean.
is_decimal - Returns whether or not the value is a decimal value.
is_empty - Returns whether or not the value is empty ("", null, 0, [], {}).
is_int - Returns whether or not the value is an integer.
is_null - Returns whether or not the value is null is_object - Returns whether or not the value is an object.
is_text - Returns whether or not the value is text.
less_than - Returns a boolean if the left value is less than the right value less_than_or_equal - Returns a boolean if the left value is less than or equal to the right value not - Returns the opposite of the existing value evaluated as a boolean not_equals - Returns a boolean if both values are not equal odd - Returns whether or not the value is odd bitwise_not Returns the existing value with its bits flipped.
equals Returns a boolean if both values are equal.
var_2 is also 7, so in this example, the result will be true.
even Returns whether or not the value is even, this returns a response of true or false.
In this example, we have a variable with the int 23 after applying the even filter the variable becomes false.
greater_than Returns a boolean if the left value is greater than the right value.
The result will be true because 23 is greater than 5. greater_than_or_equal Returns a boolean if the left value is greater than or equal to the right value.
The result will be true because 23 is equal to 23. in Returns whether or not the value is in the Array, this returns a response of true or false.
var_2 is the array [1,2,7,23].
The result will be true because 23 is IN the array.
is_array Returns whether or not the value is a numerical indexed array.
var2 is the array [1,2,7,23].
The result will be true because var_2 is an array.
is_bool Returns whether or not the value is a boolean.
False is a boolean so the result will be true.
is_decimal Returns whether or not the value is a decimal value.
9.86 is a decimal so the result will be true.
is_empty Returns whether or not the value is empty ("", null, 0, [], {}).
The result will be true because the value is an empty object {}.
is_int Returns whether or not the value is an integer.
-9 is an integer so the result will be true.
is_null Returns whether or not the value is null, this returns a response of true or false.
In this example, we have a variable with the int 23 after applying the is_null filter the variable becomes false.
is_object Returns whether or not the value is an object.
The result is true because the value is an object {}.
is_text Returns whether or not the value is text.
Hello there is a text string so the result will be true.
less_than Returns a boolean if the left value is less than the right value The result will be true because 5 is less than 12. less_than_or_equal Returns a boolean if the left value is less than or equal to the right value. | https://docs.xano.com/working-with-data/data-type-filters/comparison-filters |
e00da03b685a-1 | 5 is not less than or equal to 1 so the result will be false.
not Returns the opposite of the existing value evaluated as a boolean.
In this example, we first have the odd filter applied to 5 which results in a true boolean.
Then, the not filter is applied resulting in the opposite existing value - making the result false.
not_equals Returns a boolean if both values are not equal.
The result will be true because 5 is not equal to 6. odd Returns whether or not the value is odd, this returns a response of true or false.
5 is an odd number so the result will be true.
Previous Conditional Set Filters Next Geo Filters Last modified 1yr ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/data-type-filters/comparison-filters |
1385974ed590-0 | These are special filters that are used in the Expression Builder to compare different geography data. Covers:
Determines if one geometry covers another.
If the geometry covers the others this provides an output of true.
If it does not then it provides a value of false. Distance:
Provide the distance in meters between two geometries. Within:
Determines if one geometry is within the supplied radius of another geometry.
If the geometry is within the radius of the other then this provides an output of true.
If it does not then it provides a value of false. Previous Comparison Filters Next - Working with data Addons (GraphQL-like) Last modified 2yr ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/data-type-filters/geo-filters |
0f28b5d49b30-0 | What are Addons? Addons are a unique and easy way to enrich the response from a single API endpoint with additional data from other database tables. Addons were created to make it easy to get the data you need without performing multiple API requests. If you’ve used GraphQL before, Addons are very similar except they offer more control over how data is queried. When would I use an Addon? Imagine if you had a books table and an authors table and using Table relationships, while pulling in authors, you also wanted to pull in their associated books in the same request.
Link to YouTube Video: https://www.youtube.com/watch?v=t9qXwFVUZZ0 How do I create an Addon?
There are two different ways to create an Addon: 1. Within, the Function Stack - you can open a Query all Records function. Next, go to the Output tab and select the "+ Addon" button underneath the response body. We recommend this way. In this example, we are creating an Addon directly from the Function stack of the API endpoint GET all merchant records. 2. Within the Library tab of the navigation bar on the left side, go to Addons and select "Add" in the upper right corner. The Addon page will also have all the saved Addons created from either way. We recommend creating an Addon the first way, then doing any additional customization here. In this example, we are creating a new Addon from the Addons page of the Library. When it comes to creating an Addon, both ways are perfectly fine. We recommend starting out with the first way - from within the Query all Records function in the Function Stack. This is because it will give you the clearest picture of how you are using the Addon to extend your data in an API endpoint or Function. You will be taken through a series of steps covered in the following subpages to choose exactly how you want the data returned in your Addon.
Once you create your Addon with this framework, it will be saved to the Addons page of the Library. There, you can click on your Addon to see the workflow of an Addon. Once in the workflow view of your Addon, you are able to do further customization of your Addon that you might not be able to do through the Query all Records function flow. Previous Geo Filters Next List of Items Last modified 1yr ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/addons |
a8baa56554f9-0 | Use Addons to return a list of items that belong to something. The below example details how to create an Addon from the Query all Records function. Additionally, it shows how to use an Addon to return a list of items. The example is for a GET API endpoint that is returning all the records from the merchant table. The Addon will extend the response with the deal table, showing a list of all deals associated with the merchant record. Creating an Addon and returning a list of items: Within, the Function Stack, you can open a Query all Records function. Next, go to the Output tab and select the "+ Addon" button underneath the response body. In this example, we are creating an Addon directly from the Function Stack. Within the Query all Records function, in the Output tab, we are able to create an Addon. 2. Next, we will be given a choice to create a new Addon or choose to connect an existing one (if
we previously created one). In this example, we will choose create a new Addon. 3. Then, choose which database table to want to add to the response. This allows us to determine
which data we want to add in our API request. In this example, we will add the "deal" table to our response. 4. Choose how you'd like the data returned. There are several options that will be covered in the
subsequent pages: Single item List of items Item count Existence Aggregate In this example, we will choose a "List of items" for how we want the data returned. 5. Now, select how to connect the database tables together. Here, we must determine how the tables
are mapped together. This is usually done by a table reference to make a relationship between
tables in our database. We can also add settings for sorting, paging, and distinct records during
this step. In this example, we connect the "merchant" table to the "deal" table with deal.merchant_id. Which is the table reference to the merchant id in the deal table. 6. We can name the Addon or Xano will provide a default name. In this example, the Addon is named deal_of_merchant. 7. Lastly, we can confirm how the Addon is mapped and optionally customize the values returned
in the response. In this example, the merchant_id of the Addon (which is from the deal table) maps to the id of the merchant table. Now we can see that the response will be extended with the Addon we created. In this example, we see the Addon will extend the response of the merchant records with a list of the deal_of_merchant. Finally, when we run the API endpoint, the response is extended with the data from another table thanks to the Addon! In this example, the Addon extends our API endpoint response. We have a list of 3 deals that are associated with the merchant Zuni Cafe. Working with data - Previous Addons (GraphQL-like) Next Single Item Last modified 3mo ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/addons/list-of-items |
903ce9225fca-0 | Map an id to an object and return just a single item. Using the same framework from within the Query all Records function, this example will return a single item. Once again this example, will use an Addon to extend the response of the merchant table with the deal table. In step 1 of creating a new Addon we will add the deal table to the response: In this example, we are choosing the deal table to add to the response. Next, we will choose to return the data by a single item. In this example, we are choosing to return the data by a single item. Next, select how what fields to map the deal table to the merchant database table. In this example, we are mapping the merchant_id in the deal table to the merchant database table. Lastly, we hit done, give the Addon a name, and have the option to customize the response. Once finished, the response on the output tab will update to show us the newly extended response: In this example, we see the response is updated with the Addon. When we Run & Debug this endpoint, we will see the response is extended with the deal of merchant Addon. In this example, it will only return one single item. In this example, when we run the API endpoint with the Addon, the Addon is returning a single deal with the associated merchant record. Previous List of Items Next Count Last modified 2mo ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/addons/single-item |
0a09c8844ba8-0 | Returns a count of the number of items available. In the following example, we will use Addons to return a count of items. It will use the same example data from List of items and Single items. The example will use an Addon to extend the merchant records with a count of the deals available with each record. First, within the Query all Records function we will create and Addon. Then, we will choose the deal table to add to the response. In this example, we will add the deal table to our response of the merchant records. Next, we will choose how we want the data returned. For this example, we will return the data by item count. In this example, we are returning the Addon data with an item count. Then, we choose the field in the deal database table to map to the merchant table. In this example, we are using the merchant_id in the deal table to map to the merchant database table. The last steps are to give the Addon a name, confirm the mapped field and optionally customize the response. However, since this Addon is returning a count, we actually don't have anything to optionally customize for the Addon response. Once those steps are complete, we will see a preview of how the response of the Query all Records for the merchant table will be extended. In this example, we can see the response is being extended by the Addon deal_of_merchant. It will return a count of deals available for each merchant. Finally, once we run this API endpoint, we can see the Addon is returning a count of deals associated with the merchant record. In this example, the Addon is returning a count of 3. Meaning there are 3 deals available for the merchant Zuni Cafe. Previous Single Item Next Existence Last modified 2yr ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/addons/count |
2b24d495052a-0 | Existence tells us whether or not an item exists. Existence will return a value of true if there are any items that exists and a value of false if there are no items that exist. The following example will use the same database tables as before. However, this time we will do an Addon on top of an Addon. First, let's assume there are now two merchant records. Second, let's assume there are two deals, each associated with a different merchant. Last, let's assume we have already created an Addon showing a single item. Now we will create an Addon on top of the Addon showing the deals of the merchants. This Addon will extend the data by the ledger table. The ledger table is keeping track of what deals are used. In this example, we will create an Addon to the existing deal_of_merchant Addon. Create a new Addon, then select the ledger table to add to the response. In this example, we are adding the ledger table to the response. Next, we will select how we want the data returned. For this example, we will choose existence. Meaning specifically, whether or not a deal has been used. In this example, we are returning the data by existence. This will tell us whether or not an item exists. And in this example, that means whether or not a deal has been used. Then, we will select which fields to connect the ledger table with the deal of merchant Addon. In this example, we have a relationship in the ledger table to the deal table. You can also just think of it like mapping the ledger table to the deal table. In this example, we are select the table reference of the deal id in the ledger table to map to the Addon of the deal of merchant. Lastly, we can choose a name and confirm that the Addon is mapped correctly. There is nothing for us to customize because existence is returning a true or false value based on whether or not an item exists. Once we are finished, the response will look like this. In this example, we can see the response is being extended. First, by the deal of merchant Addon. The, with the Addon we just created the ledger of deal. Finally, when we run this API endpoint, we will see the ledger of deal Addon will return us true or false values whether an item exists. In this case, it is telling us based on the data in the ledger table, which deals have been used. In this example, ledger of deal Addon for the 10% off deal at Zuni Cafe is true. That means this deal has been used. Conversely, the 25% off deal at El Farolito has not been used because the ledger of deal Addon is false. Previous Count Next Aggregate Last modified 2yr ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/addons/existence |
a5e00132373a-0 | You can Aggregate data in Addons, which can be useful in graphs or other use cases. If you are interested in learning about Aggregating based on querying the database, you can check out the Query All Records Output documentation. The following example will show how to do an Addon that returns the data by aggregate. For this example, there will be two tables: a book table containing a book title and genre and a review table containing a table reference to the book table, comments, and a rating. This example will show how to use an Addon to return the average rating of each book. First, we will create a new Addon in the output tab of the Query all Records function for the books table. We will add the review table to the response. In this example, we are adding the review database table to the response. Next, we will choose to return the data as an aggregate. In this example, will return the data by aggregate. Step 3 has a few different options for aggregate. The first thing we must do is select how to connect the database tables. In this example, we are mapping the review table by the table reference book_id to the book table. Now we have to determine how we wish to Group, Aggregate, and Sort. First, we will group the data by the book_id. This will organize the data by each book. We can also customize the name. In this example, we are grouping the data by the book_id of the review database table. Next, we will choose which field to aggregate the data by and which aggregator to use. There are many options to use for how to aggregate the data: Avg - calculates the average number when dealing with data types such as integer or decimal. Count - counts the number of values. Count distinct - counts the number of distinct values. Max - returns the maximum value. Min - returns the minimum value. Sum - adds the values together and returns a total sum. To_list - returns an array or list of all the values. For this example, we will aggregate the data by the rating and use the aggregator avg to calculate the average rating for each book. In this example, we are aggregating by the rating field of the review table. Additionally, we are using the aggregator "avg" to return the average of the rating for each book. Lastly, we can optionally choose how to sort the data or enable paging. Sorting has two types: Ascending - lowest to highest or A to Z Descending - highest to lowest or Z to A In this example, we won't use sorting because we are returning the average so we are just getting one value anyways. Hit done, optionally customize the name, then confirm how the Addon is mapped, and customize the response if needed. Now we can see in the output tab how the Addon will extend the response. In this example, we can see the review_of_book Addon is extending the response with the book_id and rating. Finally, we can run this API endpoint with the Addon. In this example, we can see that the Addon returned the average of rating for each book. Educated has an average rating of 4.05 and Just Mercy has an average rating of 4.625. Previous Existence Next Customize the Response Last modified 3mo ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/addons/aggregate |
8d5e957f2978-0 | You can customize the response of Addons so you only return what's truly important. There are a few important things to know when you do so. Xano allows you to customize the response of an Addon (or any query) so that you can get rid of any unwanted data in your response. There's two different places that you can customize the response of an Addon, so it's important to know how they work together and when they affect one another. How are the Addon responses affected when customizing it from the Library versus in the query? The two places to customize the response of an Addon are from the Library and from the query, which the Addon is attached to. Customizing the response of an Addon from the Library is like setting a “default” response for the Addon, this default would be reflected anytime you use that Addon in a query and do not choose to customize the response output. If you choose to customize the response of an Addon from within the query that it is attached to. Then those settings will lock in for that Addon in that specific query. As long as customize response is selected there, then any changes to the response made in the Library will not affect it. If you have customize response selected in either place for an Addon and you add a new field to your database then that field will not be added to the response. You must either select it manually or if you have customize response not selected then it will automatically show up. Customizing the response from within the query that the Addon is attached to Open the query all records function where the Addon is attached to. Then, navigate to the Output tab and click on the Addon to open the settings. Select the Addon in the orange box to open the Addon's settings. Select "Customize Response" from the Addon's settings. Select Customize Response. Click the select box in order to view the fields of the Addon's response. Deselect anything you wish to not include in the response. Select customize response. Then deselect anything you wish to exclude from your response. Customize the response of an Addon from the Library Navigate to the Addon page in the Library and open the Addon. First, click on the function of the Addon. Next, open the Output tab. Then, click on "Customize." Customize the response from the Library page After follow the same steps from the previous method. Select customize response, then deselect anything you wish to exclude from the response of the Addon and save. Return as Self You have the option to change they key of which the addon return is nested under in the Output tab. You can also leave this value blank to return as 'self', which means that the output of the addon does not live in a separate key, and is instead merged directly into the parent's results. Previous Aggregate Next - Working with data Lambdas (JavaScript) Last modified 2mo ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/addons/customize-the-response |
47d1e990583c-0 | What is a Lambda?
Lambdas seem to have multiple definitions depending on who you ask... anonymous functions, serverless functions, a snippet of code, etc.
The most important takeaway is that it is a way to do business logic in a lightweight manner and return a result using a programming language.
The most popular programing language for Lambda support is JavaScript.
Is this considered Serverless computing?
Serverless computing is a concept (and buzzword) where code can be executed by some other service.
This allows you to not have to worry about maintaining your own server.
From your point of view it may feel like it is serverless, but there is still a server somewhere processing the Lambda code and returning a result.
Xano's implementation of Lambdas are processed on their own servers.
Since Xano maintains its own servers and you are supplying the code to be processed, one could make the case that Xano's Lambdas are serverless.
There is still a bit more nuance to consider, when comparing different serverless solutions to each other, but the main benefit of Xano's implementation is that it is all contained within Xano, which means any Xano customer can get started using it right away.
Wait a second... isn't Xano the No Code backend?
Yes, Xano is 100% the No Code backend.
More importantly, it is a Turing-complete backend, which means it can do anything a programming language can do through variables, conditionals, and loops.
The Lambda feature is a bit taboo, since technically it means that by allowing it to exist, one could argue that Xano has become a Low Code solution.
We have thought long and hard on this topic and we strongly believe that the power of Xano increases with this Lambda functionality and we are letting our users decide if they want to use it or not.
For No Code purists, Xano will remain the No Code backend.
For Low Code advocates, Xano will have offerings such as Lambda support.
Regardless what you choose, Xano will always remain true to its roots and remain a No Code first solution.
What can I do with a Lambda?
Lambdas have the same ability to access anything in the function stack as normal statements and filters currently do.
They just have the ability to interact and transform data using JavaScript.
See below for some capabilities to be on the lookout as you start exploring Lambdas.
Special Variables Lambdas have the ability to reference all the available data just like normal function stack statements.
All special variables are prefixed with a $ symbol.
Xano variables are accessible through the $var special variable.
To access a Xano variable named title, you would reference it as $var.title.
Xano inputs are accessible through the $input special variable.
To access a Xano input named score, you would reference it as $input.score.
Xano environment variables are accessible through the $env special variable.
To access a Xano environment variable named ip, you would reference it as $env.ip.
The authenticated user details are accessible through the $auth special variable.
The most common members of this variable include $auth.id and $auth.extras.
If there is no authenticated user, then $auth.id will evaluate as 0.
Context Variables Depending on how you use a Lambda, you may have support to access some additional variables, known as context variables.
These follow the same naming convention as special variables by using a $ prefix.
The most common context variables will be $this, $index, $parent, and $result.
The meaning of these variables are best described within the examples of the higher order filters.
Library/Function Variables One advantage of using Lambda support is that you have the ability to use powerful JavaScript libraries and functions from 3rd parties. | https://docs.xano.com/working-with-data/lambdas-javascript |
47d1e990583c-1 | Xano includes support for the following: Lodash (transformation) Moment.js (time and date) Luxon (time and date) Axios (network) Fetch (network) Math.js (advanced math) Crypto (cryptography) Nodemailer (email delivery) Promisify (utility) Xano currently doesn't support loading external libraries, but we may be able to include additional capabilities by request.
If you have a favorite, then please let us now on our feedback board.
A complete list of supported libraries with examples are detailed here.
How do I use a Lambda?
Xano supports Lambdas as a function stack statement, a filter, and as an argument to higher-order functions.
Function Stack Add a Lambda function to the function stack, This is the most basic use of Lambda support.
It is used within the function stack and has access to all inputs, environment variables, and the current state of variables just like all function stack statements have.
The purpose of this version of Lambda is to reference the required data that is accessible to it, perform some type of transformation, and then return a result, which is then stored within the name of the variable specified within this statement.
Lambda functions are inserted in the function stack and can interact with inputs and variables.
Here is an example of a function stack where there is an input named multiplier and a variable named amount.
We use the function stack version of our Lambda support to multiply the two together and then return it as a new variable named answer.
return $input.multiplier * $var.amount; Filter Lambda can also be executed as a filter.
This version of our Lambda support has one major difference between the function stack statement equivalent.
The context of the expression prior to the filter is available through a context variable named $this.
This allows you to perform Lambdas in a very light weight manner as well as have the ability to chain multiple Lambdas together through the filter stack.
Using the same example as above we can reproduce this applying a Lambda filter on the amount variable, which then lets us access it through the $this context variable.
Lambda filter using the $this variable to represent the variable where the filter is applied.
return $input.multiplier * $this; Higher Order Filters These types of filters are very powerful because they perform some type of operation (most commonly on an array of values) and use a Lambda as the input of the higher order function.
In the array use case the Lambda would be processed on each element of the array and each processing of the Lambda would have access to context variables that are applicable to each filter.
Previous Customize the Response Next Higher Order Filters Last modified 2mo ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/lambdas-javascript |
f2217062e9a3-0 | Higher Order Filters operate on a list of items and process a Lambda individually for each item.
The Lambda has access to several context variables that represent various states of the iteration process.
Details of each of these context variables are mentioned below.
map $this - the context variable that represents the element of the array being processed.
$index - the context variable that represents the numerical index of the element of the array being processed $parent - the context variable that represents the entire array with all of its elements.
The map filter is extremely powerful because it allows you to easily transform the elements of one array into another.
Here is an example of using using a map on a variable that contains a list of user objects.
We will convert that into a list of user usernames.
List of user objects.
Map filter used to transform the list of user objects The result is the list of usernames.
return $this.username; The above example changes the type of the array.
Previously it was an array of user objects, but now it is an array of text.
You can also use the map filter to return a subject each object while still maintaining the object type.
return {id: $this.id, username: $this.username}; some $this - the context variable that represents the element of the array being processed.
$index - the context variable that represents the numerical index of the element of the array being processed.
$parent - the context variable that represents the entire array with all of its elements.
The some filter (also called has or has any element) allows you to easily determine if there is at least one element of an array that matches your condition.
A common use case would be having an array of role objects and you wanted to see if a certain role was present.
List of user objects.
This will generate a true value if a role of admin is found in the array and a false value if it is not.
return $this.role == "admin"; every $this - the context variable that represents the element of the array being processed.
$index - the context variable that represents the numerical index of the element of the array being processed.
$parent - the context variable that represents the entire array with all of its elements.
This filter (also called find every element) is identical to the some filter except that it requires that all elements of the array match the condition.
A common use case would be a list of products and determining if they all have a price greater than 10.
In this example, Every filter will determine if every price in the products array is greater than 10. return $this.price > 10; find $this - the context variable that represents the element of the array being processed.
$index - the context variable that represents the numerical index of the element of the array being processed.
$parent - the context variable that represents the entire array with all of its elements.
This filter (also called find first element) is identical to the some filter except that it returns the actual element that matches the condition instead of returning whether or not it was found.
A common use case would be finding the first product that has a price greater than 10.
In this example, the first product object with a price greater than 10 will be returned.
return $this.price > 10; findIndex $this - the context variable that represents the element of the array being processed.
$index - the context variable that represents the numerical index of the element of the array being processed.
$parent - the context variable that represents the entire array with all of its elements.
This filter (also called find first element index) is identical to the some filter except that it returns the index of the element that matches the condition instead of returning whether or not it was found.
A common use case would be finding the index of the first product that has a price greater than 10. | https://docs.xano.com/working-with-data/lambdas-javascript/higher-order-filters |
f2217062e9a3-1 | In this example, findIndex will return the first element index where the price is greater than 10. return $this.price > 10; filter $this - the context variable that represents the element of the array being processed.
$index - the context variable that represents the numerical index of the element of the array being processed.
$parent - the context variable that represents the entire array with all of its elements.
This filter (also called find all elements) is identical to the find filter except that it returns it returns all elements that match the condition.
Even if there is only one match, it would return an array of one.
A common use case would be finding all products that have a price greater than 10.
In this example, filter will return all elements where the price is greater than 10. return $this.price > 10; reduce $this - the context variable that represents the element of the array being processed.
$index - the context variable that represents the numerical index of the element of the array being processed.
$parent - the context variable that represents the entire array with all of its elements.
$result - the context variable that is used to represent the result of the previous iteration or the initial value on the first iteration.
This reduce filter is a bit more complicated than the higher order examples because its environment changes each time the Lambda is processed.
The reduce filter starts out with an initial value (normally 0) and then is responsible for turning the array into a single result.
Because of this, there is a new context variable named $result which can be referenced.
The $result variable is the state of the reduction process.
The first time the Lambda runs, the $result variable is the same as the initial variable.
The return statement of the Lambda will be the $result variable for the 2nd iteration and so forth until there are no iterations left.
The final value of the $result variable will be assigned to whatever is referencing the reduce filter.
The details above may feel like a mouthful, but things should start to click when seeing a few examples.
The most basic example would be sum a list of values.
Here's an example array of [1, 10, 100].
In this example, the reduce filter will result in a sum of the array or 111.
Using an initial value of 0 we would get the sum of numbers with the following Lambda.
return $this + $result; If the above example was a list of objects instead of a list of scalar values, then the Lambda would change slightly.
In this example, we have an array of objects.
Using the reduce filter in this example, we sum the values of num for each object resulting in 111. return $this.num + $result; Working with data - Previous Lambdas (JavaScript) Next Libraries & Functions Last modified 1yr ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/lambdas-javascript/higher-order-filters |
7ef605fc8dba-0 | Lambdas become even more powerful when they can stand on the shoulders of world class libraries and functions developed by 3rd parties.
Xano currently doesn't support loading arbitrary external libraries, but we do hand pick the most popular ones based on customer demand.
If you have a favorite, then please let us now on our feedback board.
Lodash The Lodash library is considered the Swiss Army Knife of transformation.
If you are tasked with manipulating strings, numbers, objects, and/or arrays, then there is a good chance the lodash library can help.
This library is accessible within the Lambda through the library variable _ (the underscore character).
Here is an example of using the uniq function of the lodash library to return an array of unique values.
var items = [1,2,3,2,1]; return _.uniq(items); // returns a unique array of [1,2,3] Moment.js The Moment.js library is a popular library used to parse, validate, transform, and format dates and time.
This library is accessible within the Lambda through the library variable moment .
Here is an example showing how to parse an ISO 8601 formatted date, add 1 month, and then return the result in its original format.
var myDate = '2022-01-01T00:00:00.000Z'; return moment(myDate).add(1, "month").toISOString(); // 2022-02-01T00:00:00.000Z Luxon The Luxon library was built by one of the Moment.js's maintainers and is considered the next evolution of Moment.js.
This library is accessible within the Lambda through the library variable luxon.
Here is an example showing how to parse an ISO 8601 formatted date, add 1 month, and then return the result in its original format.
var myDate = '2022-01-01T00:00:00.000Z'; return luxon.DateTime.fromISO(myDate).plus({month: 1}).setZone("UTC").toISO(); // 2022-02-01T00:00:00.000Z Axios The Axios library is a popular networking library for sending HTTP requests.
This library is accessible within the Lambda through the library variable axios.
Here is an example showing how to retrieve a json response from GitHub's API.
var url = 'https://api.github.com/users/github'; return (await axios.get(url)).data; Fetch The Fetch library is another networking library for sending HTTP requests.
It is built into current generation web browsers, which makes it very popular to use because there is no additional download required.
This library is accessible within the Lambda through the library variable fetch.
Here is an example showing how to retrieve a json response from GitHub's API.
var url = 'https://api.github.com/users/github'; return (await fetch(url)).json(); Math.js The Math.js library provides support for advanced math formulas and expressions.
This library is accessible within the Lambda through the library variable math.
The standard JavaScript Math library is accessible through the variable Math, so make sure you pay attention to case sensitivity, so that you are using the appropriate library.
Here is an example showing how to perform the negative square root of 4. return math.sqrt(-4); // 2i Crypto The Crypto library is built into Node.js and useful for performing common routines related to cryptography.
This library is accessible within the Lambda through the library variable crypto.
Here is an example showing how to perform a SHA 256 digital signature.
var data = 'test123'; return crypto.createHash('sha256').update(data).digest('hex'); // ecd71870d1963316a97e3ac3408c9835ad8cf0f3c1bc703527c30265534f75ae Nodemailer The Nodemailer library provides support to send email using SMTP and other transport mechanisms. | https://docs.xano.com/working-with-data/lambdas-javascript/libraries-and-functions |
7ef605fc8dba-1 | This function is accessible within the Lambda through the function variable nodemailer.
Here is an example showing how to send a test email through ethereal.email.
This example is taken from the Nodemailer documentation.
let testAccount = await nodemailer.createTestAccount(); // create reusable transporter object using the default SMTP transport let transporter = nodemailer.createTransport({ host: 'smtp.ethereal.email', port: 587, secure: false, // true for 465, false for other ports auth: { user: testAccount.user, // generated ethereal user pass: testAccount.pass, // generated ethereal password }, }); // send mail with defined transport object let info = await transporter.sendMail({ from: '"Fred Foo 👻" <[email protected]>', // sender address to: '[email protected], [email protected]', // list of receivers subject: 'Hello ✔', // Subject line text: 'Hello world?
', // plain text body html: '<b>Hello world?</b>', // html body }); return nodemailer.getTestMessageUrl(info); // Preview URL: https://ethereal.email/message/WaQKMgKddxQDoou... Mailparser The Mailparser library is an addon for Nodemailer.
This function is accessible within the Lambda through the function variable mailparser.
Here is an example showing how to instantiate it.
const MailParser = mailparser.MailParser; let parser = new MailParser(); return typeof parser; // object Promisify The Promisify function is built into Node.js and is useful for converting legacy callback routines into a Promise based variant.
Promises are a standardization of how responses are received in asynchronous programming, which makes it possible to rely on shorthand keywords like async.
This function is commonly used along with the Crypto library for those wishing to use that library with Promises instead of callbacks.
This function is accessible within the Lambda through the function variable promisify.
Here is an example showing how to use Promisify on the Crypto library to generate an HMAC secret key.
return (await promisify(crypto.generateKey)('hmac', {length: 64})) .export() .toString('hex'); Node Libraries The following node libraries are available within Xano's Lambda support: DNS, HTTP, HTTPS, and NET.
They are accessible within the Lambda through the function variables: dns, http, https, and net.
Here is an example showing how to create a custom https agent.
const httpsAgent = new https.Agent({ keepAlive: true }); Socks The Socks library is a fully featured SOCKS proxy client supporting SOCKSv4, SOCKSv4a, and SOCKSv5 protocols.
This library is accessible within the Lambda through the library variable socks.
Here is an example showing how to create a connection.
const options = { proxy: { host: '159.203.75.200', // ipv4 or ipv6 or hostname port: 1080, type: 5 // Proxy version (4 or 5) }, command: 'connect', // SOCKS command (createConnection factory function only supports the connect command) destination: { host: '192.30.253.113', // github.com (hostname lookups are supported with SOCKS v4a and 5) port: 80 } }; return await socks.SocksClient.createConnection(options); Ethers.js This library aims to be a complete and compact library for interacting with the Ethereum Blockchain and its ecosystem.
This is accessible within the Lambda through the function variable ethers.
Here is an example of formatting a number in Ether.
return ethers.utils.formatEther(10); // 0.0000000000000001 Azure/Identity This library provides Azure Active Directory (Azure AD) token authentication through a set of convenient TokenCredential implementations.
This is accessible within the Lambda through the function variable azure.identity.
Here is an example of generating default Azure credentials with Azure/Identity. | https://docs.xano.com/working-with-data/lambdas-javascript/libraries-and-functions |
7ef605fc8dba-2 | return new azure.identity.DefaultAzureCredential(); Azure/Service-Bus Here is an example of generating a service bus client connection with Azure/Service-Bus.
This is accessible within the Lambda through the function variable azure.serviceBus.
This library provides access to Azure Service Bus, which is a highly-reliable cloud messaging service from Microsoft.
return new azure.serviceBus.ServiceBusClient('your-connection-string'); Zeebe This library is a Node.js gRPC client for Zeebe, the workflow engine in Camunda Platform 8.
This is accessible within the Lambda through the function variable zeebe.
Here is an example of generating a timeout duration with Zeebe: return zeebe.Duration.seconds.of(30); Previous Higher Order Filters Next - Working with data Date & Times Last modified 2mo ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/lambdas-javascript/libraries-and-functions |
a8f15eda80c5-0 | A timestamp is a sequence of characters or encoded information identifying when a certain event occurred.
Timestamps
Link to YouTube Video: https://www.youtube.com/watch?v=zfW1x6DKyLw Xano stores timestamps as a unix timestamp in milliseconds.
Unix timestamp is a way to track time as a running total of seconds.
This count starts at the Unix Epoch on January 1st, 1970 at UTC.
For example:
1604959474 seconds since Jan 01 1970.
(UTC).
This epoch translates to 11/09/2020 @ 10:04pm (UTC).
Since Xano uses milliseconds, the timestamp would be 1604959474000.
There is no timezone in a timestamp because it is the number of milliseconds from the unix epoch - Jan 1, 1970.
What is the difference between a timezone region, a timezone abbreviation, and a timezone offset?
A timezone region handles daylight savings time for you.
For example:
America/Los_Angeles will automatically be PST or PDT depending on the actual timestamp.
It handles this behind the scenes so you always have the right timezone offset.
Timezone regions are listed here.
A timezone abbreviation is the shortened 3 letter abbreviation (PST, PDT, etc.).
This represents a timezone offset:
PST is -0800 and PDT is -0700.
These values are always the same.
It is recommended to use the timezone region mentioned above so you don’t need to keep changing the abbreviation selection with daylight savings time changes.
When I choose a time from the database table viewer, what timezone is used there?
The database table view is using the unix timestamp internally but transforming it in the spreadsheet view to the timezone of your browser.
This means that if someone else was looking at it from a different timezone, they would see the time that is local to themselves.
However, you can change the browser default settings to your preferences for the date & time format and timezone offset that is shown in your database on the account page.
What are my options for inputting a timestamp into Xano through the API?
Raw timestamp in milliseconds (this would not need any timezone information).
For example:
1604959474000 ISO 8601 format, which is Year-Month-Day then a “T” and then 24hour-minute-second then “the timezone offset in hours and minutes”: 2004-02-12T15:19:21+00:00 Postgres database format, which is similar to the ISO 8601 format:
2020-11-09 14:13:18-0800
(Note: a space is used to separate the date from the time instead of the “T” character in ISO 8601.
Also, the offset does not include the colon.)
Relative time.
Xano uses relative time formats from php.net.
For example:
now, last Monday, +7 days, etc.
(Relative times normally don’t have any timezone information, so it will often be important to reference the timezone in any type of filter.)
Here are relative time formats and their meanings that Xano accepts (source: php.net).
Parse Timestamp the parse_timestamp filter allows you to take a human-readable time format and parse it into a Unix timestamp in milliseconds to be stored in the Xano database.
The characters used are the same as formatting date and time and can be found here from php.net.
What are my options with formatting date and time?
There are lots of options available.
A full list is available here from php.net. | https://docs.xano.com/working-with-data/timestamp |
a8f15eda80c5-1 | Here are a just few examples: c = 2004-02-12T15:19:21+00:00 r = Thu, 21 Dec 2000 16:01:07 +0200 Y-m-d H:i:s = 2000-01-01 00:00:00 See the Timestamp Filters page to see how to use timestamp filters in Xano.
Previous Libraries & Functions Next - Team Collaboration Real-time Collaboration Last modified 1yr ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/working-with-data/timestamp |
37a749d808e4-0 | Use Xano with a team to develop even faster. Every Xano workspace includes Real-Time Collaboration which enables you to edit your API simultaneously with your team, just like a Google Doc!
Link to YouTube Video: https://www.youtube.com/watch?v=91JBboWapDI Presence Real-time presence informs you when a team member is working on the same Function Stack as you at the top of the page with their initials. Each team member’s initials will be displayed on the function stack item they are currently editing. Example of real-time presence Team Activity & Secure Chat Clicking this will open the Collaboration panel. You can see the current chat history, and send your own messages from here. Please note that chat history only persists per session; if you refresh your browser any current chat messages will disappear from your view. This Collaboration panel also displays a list of users who are currently present in the workspace, and what page they are on. You can use this to quickly navigate to where another user is working. The chat and activity panel, showing recent chat messages When a new message is sent, it is broadcasted to all users currently present in the workspace via a notification in the lower-left corner. An example of an incoming chat message Group Editing Xano allows you to see when functions are being worked on by another team member. This is noted on the right side of each function, as shown below. An example of advertised presence on a function Revision History As your team members make changes, you can see these drafts by clicking the Revertable Changes indicator at the top of the page. You can see a history of changes your team members have made in Drafts. An example of revertable changes on a function stack Requesting Access to Edit a Function When trying to access a function that is currently being worked on, you'll be given a notification in the lower-left corner notifying you of this, and giving you an opportunity to request edit access. When you request access, the other user is notified and can either grant you edit access to this function, or ignore your request. Working with data - Previous Date & Times Next - Team Collaboration Agency Plan Last modified 4mo ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/team-collaboration/real-time-collaboration |
b3e3e393c77e-0 | Link to YouTube Video: https://www.youtube.com/watch?v=d9dWAiNeNNU The Agency plan is a unique offering specifically designed for development agencies and freelancers who are developing projects for clients. Some of the unique features include: Easy client setup & handoff Centralized management Robust agency server setup Private “internal” marketplace Shared income - earn % commission for every new sign-up Xano partnership - eligible to receive “sourced” leads via Xano And more! Sign-Ups = Zero Cost! If you are already a Xano client with existing client referrals, you will most likely start this agency plan with no cost to you!
If you are new to Xano, you can get the cost of your plan covered by signing up client(s). Each client you sign up will earn you 100% credit towards your Agency plan’s monthly fee. Once you reach the cost of your plan, our standard partner referral commissions kick-in and you will start to earn 20% commission MoM. See more about commission and the accelerated commission structure. Read about the Agency plan: Client Invite (Client Invite & Onboarding) Transfer Ownership (Transfer projects to clients) Private Marketplace Commission Team Collaboration - Previous Real-time Collaboration Next Client Invite Last modified 2mo ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/team-collaboration/agency-plan |
1d7f7abc18fc-0 | From the Instance page, enter your Agency dashboard under Agencies you manage on the right side. Once inside the Agency dashboard, select Invite a new client. Fill out the Client Invite form with the client's name and email address. You may optionally include a personal note to the client as well. Next, select a recommended package for your client with any additional features. Send invitation and the client will be notified by email. Your client will have final say as to which package they select. Client Accepts Invitation Once your client accepts the invitation you will be notified by email and the instance will be linked to your Agency dashboard. There are different scenarios depending if a client is brand new to Xano or already has an existing account. The Client is Brand New to Xano If the client is brand new to Xano, they will be required to sign up. The plan that you curated for the client will be defaulted for them to sign up but they do have the ability to change it to a different paid plan. The Client has an Existing Xano Account When the client has an existing Xano account, the recommended plan will be displayed. The client will choose from three options before getting started. An existing Xano client will choose from three different options to set up and link their Instance with the Agency. Option 1 - Create a brand new instance This option creates a brand new instance for the client from scratch. This is a new instance separate from any work previously done in the client's existing instance. The Agency will automatically be linked up to the client's new instance to assist with ongoing Xano development. Option 2 - Upgrade an existing instance This option enables the client to upgrade their existing instance to the plan recommended by the Agency. It will automatically link the instance to the Agency after the upgrade is completed. Option 3 - Allow the Agency to manage the existing paid instance without upgrading Option 3 will link the Agency to the existing paid instance (if there is one). With this option, the client does not want to upgrade to the recommended plan but instead chooses to keep their instance configuration as is. Option 3 does not apply if the client has a Build plan. Only paid plans can be linked to an Agency. Team Collaboration - Previous Agency Plan Next Transfer Ownership Last modified 1yr ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/team-collaboration/agency-plan/client-invite |
2a79ea27c279-0 | Transfer ownership of a workspace to a client Instance. One of the unique features of the Agency plan is the ability to transfer ownership of a workspace to a client Instance. This feature may be useful if you need to start development on a client project before the client is on a Xano instance. You are able to start a project in a workspace within your Agency instance. Once the client sets up their instance and links it to your Agency via the client invite process, you can perform a transfer of ownership. The transfer ownership action can be found in the menu icon of the client dashboard. Transfer Ownership is accessible from the Client Dashboard. You will be able to select a workspace from within your Agency plan instance to transfer ownership: Choose a workspace from your Agency to transfer. Next, choose a client Instance to transfer to workspace to: Choose a client instance to transfer the workspace. Confirm the transfer. A copy of the workspace will be transferred into the client Instance. Once complete, you can navigate to the client Instance from the client dashboard and see the workspace in your client's Instance. It's recommended that any development from this point on be done on the workspace that is hosted in the client Instance. Changes to the copy on the Agency instance will not be reflected in the copy of client Instance. Previous Client Invite Next Private Marketplace Last modified 1yr ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/team-collaboration/agency-plan/transfer-ownership |
1c9ac0159c94-0 | Create Snippets only available for you and your clients.
Also, Secure Share is available for one-time use of your Private Snippets.
The Private Marketplace allows you to create Private Snippets exclusively for the clients of your Agency plan.
Create a Private Snippet To create a Private Snippet, navigate to the "Private" tab on the left menu and select your Agency's name.
Then select "Create Snippet" in the top right corner.
Navigate to the Private Marketplace to create a Private Snippet Creating a Private Snippet has the same UI and experience as creating a regular, shareable Snippet.
Creating a Snippet You can add as many API Endpoints as you want for a Private Snippet.
Add as many relevant API Endpoints as needed for the Snippet.
Review the included content, especially the database table and records.
When a Snippet uses a database request, the associate database tables will be included.
You may optionally include records along with the Snippet.
Be very careful not to share sensitive information.
Optionally include data records to the Snippet.
Once the Snippet is created, it will automatically be published for your clients.
Managing the Private Marketplace The Private Marketplace has two views from your Agency instance: Created Within Your Agency and Published Within Your Agency.
Created Within Your Agency shows all the Private Snippets that have been created within your Private Marketplace.
Published Within Your Agency shows all the Private Snippets that are available to be viewed and installed by your clients within the Private Marketplace.
Unpublish a Private Snippet To unpublish Private Snippet, start on the Created Within Your Agency view and select the Snippet that you wish to manage.
Select a Snippet to manage.
Open the menu icon in the top right and select manage.
Open the menu icon to manage the Snippet.
Unpublish the Snippet.
Unpublish a Snippet.
Create Update or re-Publish a Snippet.
When creating a Private Snippet, it is automatically published.
If you unpublish a Private Snippet and later decide to publish it again, you do so by selecting Create Update.
Create Update also lets you make any changes and updates to an existing Snippet.
Create Update lets you make any changes or re-publish a Snippet.
Once you select Create Update, the same experience as Create Snippet will be shown and you can make any changes to the Snippet and select Update.
Client Install of a Private Snippet To install a Private Snippet into a Client's Workspace, go to the Client's Instance and then select the desired Workspace to install it to.
The Agency who manages the Client Instance or the Client can perform this action.
Navigate to the Private tab on the left side and select the Published Within Agency tab.
See the Snippets published by the Agency from the Client's workspace.
Click on a Snippet you wish to install.
You will first be prompted to "Get" the Snippet, which adds the Snippet Instance-wide.
Once that action is performed, the Get button change to Install and it can be installed on the individual workspace.
Other workspaces on the Instance would be required to Install the Snippet in order to add it.
Install a Snippet.
Secure Share Secure Share enables you to require a security token for the Snippet to be viewed externally.
Each token is only valid for a single installation.
If you are going to share with multiple individuals, make sure to generate a unique link for each individual.
In order to securely share a Snippet, navigate to the Private Marketplace and select a Snippet from the Created Within Your Agency tab.
In the top right corner, select Secure Share.
Secure Share a Snippet.
Select Generate to generate a security token.
Generate a Security Token.
Once generated, a one-time use link will be generated with a unique security token.
This link is good for a one-time use.
You can copy it and send it securely for someone to use it once. | https://docs.xano.com/team-collaboration/agency-plan/private-marketplace |
1c9ac0159c94-1 | A one-time use link will be generated to share.
The landing page for a Secure Share and installation will be the same as a regular Snippet.
Previous Transfer Ownership Next Commission Last modified 1yr ago WAS THIS PAGE HELPFUL? | https://docs.xano.com/team-collaboration/agency-plan/private-marketplace |
6c4b761a28b7-0 | The Agency plan automatically enrolls you in the Xano Partner Program enabling you to earn commission on client invites.
Commissions can be viewed only by the owner of the Instance.
Commissions are shown in the top right of the Client Dashboard: The Instance owner can view commissions from the Client Dashboard.
Agency Commission Stats Agency stats show you commission information tied to your Agency plan.
You can see the active client instances, subscriptions, client invoice history, (additional) credits, and payouts.
The Agency commission stats Agency plans earn 20% commission on client invoices.
To receive a payout, you must add your PayPal email address.
(You can do this from your account page).
Payouts require a minimum amount earned (this is typically $100 but might depend on your Partner Program Agreement).
Credits are additional commissions earner as part of the accelerated commission program.
Accelerated Commission (Credits) With the Agency plan, you can get accelerated commission (credits) up to the full price of your Agency plan.
How accelerated commission works A Xano Agency partner can receive full payment (minus Stripe transaction fee 2.9% + $.30) until the monthly Agency fee goes down to $0.00/mo.
Then a 20% partner reseller commission will be initiated.
Below you will find four scenarios for the Month of March (31 days) that show a high-level overview of the Xano Agency commission structure.
Please note that the Xano Agency plan is a part of our partner program and all commission payments are made via PayPal on the 1st & the 15th of each month.
Scenario 1 Overview: On March 1st a development firm signs up to a monthly Xano Agency Plan ($350/mo).
Breakdown: March 1: Agency pays $350.
Agency does not sign up any new clients in March.
April 1: Agency pays $350.
Scenario 2 Overview: On March 1st, a development firm signed up to the monthly Xano Agency Plan ($350/mo) with a new client for a monthly Scale Plan ($225/mo).
Breakdown: March 1: Agency pays $350.
March 1: Client pays $225.
April 1: Agency pays $350 April 1: Client pays $225.
April 1: Agency gets a PayPal payment from Xano for $218.17.
Transaction Details: $225 - $6.83 (Stripe transaction fee 2.9% + $.30cents) = $218.17 payment commission applied for the month of March.
Scenario 3 Overview: On March 1st, a development firm signed up to the monthly Xano Agency Plan ($350/mo) with signing up (2) new clients with each a monthly Scale Plan ($225/mo).
Breakdown: March 1: Agency pays $350.
March 1: Agency Client (A) pays $225.
March 1: Agency Client (B) pays $225.
April 1: Agency pays $350.
April 1: Agency Client (A) pays $225.
April 1: Agency Client (B) pays $225.
April 1: Agency gets a PayPal payment from Xano for $367.27 (applied to the month of March).
Transaction Details: $225 + $225 = $450 - $13.66 (Stripe transaction fee 2.9% + $.30cents) = $436.34 $436.34 - $350 = $86.34 x 20% commission = $17.27 $350 + $17.27 = $367.27 PayPal payment.
Scenario 4 Overview: On March 1st, a development firm signed up to a monthly Xano Agency Plan ($350/mo).
On March 14, the development firm signed up its first new client with a monthly Scale Plan ($225/mo).
Breakdown: March 1: Agency pays $350. | https://docs.xano.com/team-collaboration/agency-plan/commission |