Xano Response

This guide aims to clarify two key aspects: returning an object 'As Self' versus returning an array with the Results Key.


Returning an Object 'As Self':

If sending Notifications to Xano Users, the GET ALL Endpoint for Users must send the response 'As Self' or notifications will not be received.

When you select to return an object 'As Self' in Xano, you're opting for a streamlined approach that provides a single, comprehensive object containing specific attributes. This is particularly valuable when you expect to receive detailed information about a single record or entity.

Example Use Case: Retrieve an in-depth user profile by querying the User ID. The response will consist of a single object encompassing all relevant User attributes.

Implementation Steps:

  1. In the endpoint's response definition, specify desired attributes.

  2. Map these attributes to corresponding fields in your data source.

  3. Select 'As Self' to receive a single, detailed object.

Returning an Array with the Results Key:

Must be used when setting up with External Collections.

Choosing to return data as an array with the Results Key structures your response as a consistent array of objects, even if only one record matches your query. Each object within the array represents an instance of the queried data.

Example Use Case: Fetch a list of products within a specific category. Regardless of the number of products, the response remains consistent, promoting seamless data management.

Implementation Steps:

  1. Define attributes to include in the response.

  2. Map attributes to respective fields in your data source.

  3. Enable the "Results Key" option and assign a meaningful name (e.g., "products").

Guidelines for Selection:

  1. Use 'As Self' When:

    • Detailed information about a single entity is required such as user profiles or unique records.

    • Using Notifications with Xano Collections.

  2. Use Array with Results Key When:

    • Handling a collection of records, be it a list of items, categories, or sets of data.

    • Using Xano Endpoints through External Collections

Last updated