# Welcome to Cosmocloud

[Cosmocloud](https://cosmocloud.io) is your **pluggable, no-code, backend micro-service**, which allows you and your developers to build your application's backend components **in minutes**!

Cosmocloud can work both as your primary backend service (**monolith**), as well as plugged into your existing system (**micro-service**). Think of Cosmocloud as a **100% managed** developer platform to **build and deploy** your backend micro-services which can be independently be built, deployed and scaled as much as required!

{% embed url="<https://www.youtube.com/watch?v=0kOZudVNcvE>" fullWidth="false" %}
Cosmocloud Teaser
{% endembed %}

## Checkout the awesome resources we have for you!

* [Basic Setup](#basic-setup)
* [Concepts](#concepts)

{% hint style="info" %}
If you look to deploy Cosmocloud in your business, reach out to [Cosmocloud Support](mailto:support@cosmocloud.io) for our awesome dedicated support team to help you build and scale much more quickly! 🚀
{% endhint %}

## Basic Setup

<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-type="content-ref"></th><th data-hidden data-card-target data-type="content-ref"></th><th data-hidden data-card-cover data-type="files"></th></tr></thead><tbody><tr><td><h4>Getting Started</h4></td><td>Start using Cosmocloud by building your first backend application. You can start for free!</td><td><a href="/pages/duE5LZlZPhDAPa8sQtqX">/pages/duE5LZlZPhDAPa8sQtqX</a></td><td><a href="/pages/duE5LZlZPhDAPa8sQtqX">/pages/duE5LZlZPhDAPa8sQtqX</a></td><td><a href="/files/ZWJRsdNREyXbN9lHexkp">/files/ZWJRsdNREyXbN9lHexkp</a></td></tr><tr><td><h4>Cosmocloud Free Tier</h4></td><td>Cosmocloud comes with a Free Tier that you all can use and explore! Checkout it our now!</td><td><a href="/pages/WDMNls7IpEbfJSKzgn4B">/pages/WDMNls7IpEbfJSKzgn4B</a></td><td><a href="/pages/Rl2TPi7bgNsEpMHBgYZf">/pages/Rl2TPi7bgNsEpMHBgYZf</a></td><td><a href="/files/QmIfFSZNz8HYnYhPICor">/files/QmIfFSZNz8HYnYhPICor</a></td></tr><tr><td><h4>Sample Tutorials</h4></td><td>Checkout the different tutorials Cosmocloud has the offer while building your Backend layer.</td><td><a href="/pages/vKt5QttPHuBaLWBfJkzV">/pages/vKt5QttPHuBaLWBfJkzV</a></td><td><a href="/spaces/vTMtDI5nM3rZwaURRww4">/spaces/vTMtDI5nM3rZwaURRww4</a></td><td><a href="/files/9DVPuAWqYF5dhQTsy17e">/files/9DVPuAWqYF5dhQTsy17e</a></td></tr><tr><td><h4>Help &#x26; Support</h4></td><td>Looking for help, support or community? Check this out now!</td><td><a href="/pages/RCu7oZbHRadUp1tq7lRh">/pages/RCu7oZbHRadUp1tq7lRh</a></td><td><a href="/pages/RCu7oZbHRadUp1tq7lRh">/pages/RCu7oZbHRadUp1tq7lRh</a></td><td><a href="/files/IHQ0TTATvEnSd9VXnops">/files/IHQ0TTATvEnSd9VXnops</a></td></tr></tbody></table>

## Concepts

<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden></th><th data-hidden></th><th data-hidden data-card-target data-type="content-ref"></th><th data-hidden data-card-cover data-type="files"></th></tr></thead><tbody><tr><td><h4>Concepts and Resources</h4></td><td>Checkout the different resources you can create and build with Cosmocloud.</td><td></td><td></td><td><a href="/pages/JOk77nP09iYwAIg3avoh">/pages/JOk77nP09iYwAIg3avoh</a></td><td><a href="/files/Z5mAPeIB28hvwau0DFIq">/files/Z5mAPeIB28hvwau0DFIq</a></td></tr><tr><td><h4>Flow Builder</h4></td><td>From APIs to Functions to Consumers, everything uses our awesome Flow Builder!</td><td></td><td></td><td><a href="/pages/Jc9Jpy41vibvseqwMbPN">/pages/Jc9Jpy41vibvseqwMbPN</a></td><td><a href="/files/luRiDS4IuGJII8IlHHaw">/files/luRiDS4IuGJII8IlHHaw</a></td></tr><tr><td><h4>(CQL) Cosmocloud Query Language</h4></td><td>Learn how to create complex logics, and use state values in building complex Flows.</td><td></td><td></td><td><a href="/pages/2G7w04v1WBlx5h6CQnny">/pages/2G7w04v1WBlx5h6CQnny</a></td><td><a href="/files/BzI2YpFKrqj6Ehcu2d4a">/files/BzI2YpFKrqj6Ehcu2d4a</a></td></tr><tr><td><h4>User Management</h4></td><td>Share your projects with your team, give them different level of access and scale your application!</td><td></td><td></td><td><a href="/pages/aZndJtZTFCv9o8PAY1ix">/pages/aZndJtZTFCv9o8PAY1ix</a></td><td><a href="/files/jzuZTfv2blw6j8GojS12">/files/jzuZTfv2blw6j8GojS12</a></td></tr></tbody></table>


# Getting Started

Setting up your development environment is a breeze with Cosmocloud. Enjoy a seamless and straightforward process, making development a piece of cake.\
\
You can quickly create your new Cosmocloud account by [**signing up**](https://dashboard.cosmocloud.io/sign-up) from here.

{% hint style="info" %}
You would need a unique username to create your account.
{% endhint %}

## Let's start creating on Cosmocloud

1. [<mark style="color:blue;">Creating Organisations</mark>](/getting-started/1.-organisations)
2. [<mark style="color:blue;">Creating Projects</mark>](/getting-started/2.-projects)
3. [<mark style="color:blue;">Connecting your Database</mark>](/getting-started/3.-connect-your-database)
4. [<mark style="color:blue;">Creating Database Models</mark>](/getting-started/4.-create-database-models)
5. [<mark style="color:blue;">Creating APIs</mark>](/getting-started/5.-create-apis)
6. [Testing Free Tier APIs](/getting-started/6.-testing-free-tier-apis)


# 1. Organisations

A Cosmocloud Organisation serves as the central framework for managing all of your projects and data, effectively organising them under a unified namespace. This facilitates streamlined access and management across your various projects.

## Creating an Organisation

When you sign up for Cosmocloud, your first step is to create an Organisation. This can be done during the sign-up process or later by visiting the organisation listing page on the Cosmocloud platform.

{% hint style="info" %}
Currently, each user is permitted to **create only one Organisation**.
{% endhint %}

Moreover, the name chosen for your Organisation must be unique across the entire Cosmocloud universe. We’ll prompt you in case you choose a name that already exists :innocent:

<br>


# 2. Projects

A Project within Cosmocloud functions as an individual backend service or a Micro-service. Each project can be independently managed, built, and scaled to suit your operational needs.

## Creating a New Project

To initiate a new Project, visit your Organisation's project listing page on the Cosmocloud platform. When creating a project, you will be prompted to choose your Project Name, Cloud provider, and region.

* **Name -** Choose a name for your project that is unique within your Cosmocloud Organisation to avoid any naming conflicts.
* **Cloud Provider -**  Select your preferred cloud service provider.
* **Cloud Region -**  Specify the cloud region where your project and infra resources will be hosted. You can view a [list of available regions here](/references/available-cloud-and-regions).

<figure><img src="/files/e3w6KC7gobjQOKOZ5Iv5" alt=""><figcaption></figcaption></figure>

When setting up a new Project, you get 1 shared Development environment in [Cosmocloud’s Free Tier](/free-tier). This Environment runs on shared resources and has a few limitations -&#x20;

* You can have a **maximum of 100 API calls per da**y on Free Tier environment.
* You get **only 1 Storage Account** with a **maximum capacity of 512MB** of storage on Free Tier.
* Free Tier environment is on shared infra, and is ideal for exploration, but not for production use cases.

<figure><img src="/files/4uVbDYkJk7UENpLLdFN8" alt=""><figcaption></figcaption></figure>

> As soon as you create your Project, you will land up on the Project Dashboard.

You can later [upgrade your Project](broken://pages/M1I3t8Qk7UmW2zIPGzuo) to create dedicated environments.

{% hint style="info" %}
Each Project will start with a Free Tier, having 1 Development Environment available by default.
{% endhint %}


# 3. Connect your Database

Cosmocloud champions your data sovereignty with the innovative **BYOD model - Bring Your Own Database.**

Take complete control of your data, knowing that we prioritise your ownership above all. At Cosmocloud, your privacy is paramount; we never own your data. Experience true autonomy and peace of mind, as Cosmocloud empowers you to steer your projects with full confidence and security.

{% hint style="info" %}
Cosmocloud can spin up dedicated databases for you in Pro projects, on demand. To get Cosmocloud to spin up dedicated databases for Pro projects, reach out to [Cosmocloud Support](mailto:support@cosmocloud.io).
{% endhint %}

{% embed url="<https://www.youtube.com/watch?v=ikve8ADVVFY>" fullWidth="false" %}
Connecting your Database
{% endembed %}

## Linking your Database

Start by linking your own MongoDB Database with Cosmocloud's project. On Free Tier, Cosmocloud only supports MongoDB Atlas's Data APIs to connect to your database. As you upgrade to Pro, Cosmocloud uses native connection pools (using MongoDB SDK) to connect.

{% hint style="warning" %}
It is not advised to use a Free Tier Project for Production use cases. Checkout [how to upgrade to a Pro Project](broken://pages/M1I3t8Qk7UmW2zIPGzuo)<mark style="color:blue;">.</mark>
{% endhint %}

Currently, Cosmocloud only supports MongoDB, but integration with more databases is in works behind the scenes and we’ll bring them to you soon!

### Steps to connect you cluster

You can start free by [spinning up an M0 cluster](https://www.mongodb.com/docs/atlas/tutorial/deploy-free-tier-cluster/) on your own [MongoDB Atlas account](https://cloud.mongodb.com) and then connecting the same with Cosmocloud with below steps!

Once your cluster is ready, follow these steps -

1. Head over to the **Secrets** tab in your project to start creating a secret
2. When creating your secret, choose the environment required. On the Free Tier, the only env available is Development.

<figure><img src="/files/31Fy7t3olNO8c3LQViej" alt=""><figcaption></figcaption></figure>

Next, you will be prompted to input your MongoDB cluster details. Then, Head over to[ MongoDB Atlas](https://cloud.mongodb.com/), create a new Database Cluster, or use an existing one.

3. Create an **API key** for Cosmocloud to connect to MongoDB Atlas.
   1. Open your MongoDB Atlas account.
   2. Click on **Access Manager** on the top of MongoDB Atlas page and select **Project Access**.
   3. Click on **Create API Ke**y on the left side.
   4. **\[Important]** Name your key `cosmocloud-apikey` and give it **Project Owner** role.
   5. On the next step, copy your **Private and Public keys** and store them securely, to be used in Step 4.
4. When creating a **Database** type Secret, Cosmocloud will ask you for these details -
   1. **Database name:** The name of the logical DB where your data would be stored.
   2. **MongoDB Atlas Public Key:** The public key you copied above.
   3. **MongoDB Atlas Private Key:** The private key you copied above.
   4. **Project ID:** Your MongoDB Atlas Project's ID. You can find this on your MongoDB Atlas project's settings page.
   5. **Cluster name:** The name of the Atlas Cluster you created (case sensitive, for eg. Cluster0)

<figure><img src="/files/lZa2DdCpq7gtW0OeqfhS" alt=""><figcaption></figcaption></figure>

After clicking on Create, it will take **30-45 seconds (on Free Tier)** to establish a test connection with MongoDB, and a success message will be displayed. In case there’s an error in filling up the secrets, you will be notified about the same

<figure><img src="/files/71Mkw3913CJe4I2iboDp" alt=""><figcaption></figcaption></figure>

You now have successfully connected your database!


# 4. Create Database Models

To quickly start building applications on Cosmocloud, you would be creating various Models and APIs on the platform.

You can start by creating your first model, for ex. **Students**. You can do so by -

1. Visit the Models page via **Application Layer -> DB Models** from the Cosmocloud project's dashboard.
2. Click on **Create Model** button.
3. Select the type of Model as **Database Collection** to create a database schema for your new entity. Checkout here for [more model types](/resources/models).
4. Add a name to your model (for ex. `Students`) as well as a description.
5. Click on **Create**.

Now you can go ahead and define the schema of your newly created Model under the **Schema** tab. [Checkout how to define model schemas](/resources/models/building-models).


# 5. Create APIs

APIs are the most basic building blocks of any backend layer and allows external systems (frontend, clients, etc) to interact with your system to fetch, insert or modify data.

You can start by creating your first APIs by -

1. Visit the APIs page via **Application Layer -> APIs** from the Cosmocloud project's dashboard.
2. Click on **Create API** button. It will ask you which way to create the APIs.
   * **Using Templates:** API templates are a fast way to create the skeletons of your APIs and then later you can customise and tweak the logic.
   * **Building from Scratch:** This method allows you to create your APIs from scratch, allowing you to customise your **endpoint**, **request method**, and then starting to design the same from scratch.
3. For starting, you can select **Using Templates** to start building your first APIs.
4. Let's start using the **CRUD APIs** template for now.
   1. Select the template - CRUD APIs and click Next.
   2. On the second step, chose the Database Collection model you had created in [Step 4](/getting-started/2.-projects) and click Next.
   3. On the final step, Cosmocloud will suggest you which all APIs and corresponding models would be created for you.
   4. You can either select all, or select only the ones you would require -- **Don't forget to select / unselect the corresponding request body models as well.**
5. Click on **Create** to create all these APIs into the system and Voila! All of them are ready to use.

You can now try hitting these APIs with Postman or similar tools (like curl). Checkout the next step on how to hit and test the APIs.

{% hint style="info" %}
To customise and tweak the logic of these APIs, checkout [creating API flows](broken://pages/8z0rUKU7stKO2y2rf6fw).
{% endhint %}


# 6. Testing Free Tier APIs

If you are done with the previous steps, you can now start to test your APIs out. As we are running a sample Free Tier project in this Setup guide, there would be **no need to release and deploy** the APIs. All the APIs created in Draft mode (in development mode) can be tested on the free tier Development Environment **instantly and immediately 🚀.**

{% hint style="info" %}
Cosmocloud is an instant deployment platform, where as soon as you click Save Button (on Free mode) or release a new version (Pro mode) your APIs are already deployed and live. No need to wait for any deployment jobs or switchovers to happen.

Everything is **Instantly Deployed 🚀**

[Learn more on this here](/advanced-guide/performance-considerations/instant-deployments)
{% endhint %}

## Trying our your new APIs

1. Just open any API you would want to test and copy the **Development Endpoint** for that API.
   * You can also find the Base URL of your Development Environment in **Application Layer -> Environments**.
2. Open Postman and add your API there along with required fields like **request method**, request body, etc. needed for the API.
3. Add the required keys in **Headers** to call your APIs.
   1. **projectId** : The ID of your Cosmocloud Project. You can find this by clicking on your `Organisation's name` on the top left of your dashboard. You can find this ID in the list of Projects inside your Organisation.
   2. **environmentId** : You can find this by visiting **Environments** page in your Project's dashboard. Copy the **Development** environment's ID.
4. Hit the API !

{% hint style="info" %}
The above Headers are only required while calling the Development environment in Free projects. For dedicated environments in a Pro project, you mat not pass these headers.
{% endhint %}


# Free Tier

The Cosmocloud Free Tier is designed to help developers get started with our platform quickly and easily. This guide provides in-depth information about the Free Tier, its features, limitations, and best practices.

## Overview

The Free Tier is perfect for:

* Individual Developers
* Proof of Concept Applications
* Learning and Exploring Cosmocloud's capabilities

It provides a robust set of features while maintaining certain limitations to ensure fair usage across our platform.

## Free Tier Limits

To prevent system abuse and ensure fair usage, the Free Tier comes with the following restrictions -

* Each user can create only **1 Organisation**, with only **1 Project** allowed.
* Each Project can have only 1 Environment (Development).
* Development Environment will have a **daily limit of 1000 API** calls per project, refreshing at 00:00 IST everyday.
* For enhanced security, you need to pass [additional headers](/getting-started/6.-testing-free-tier-apis) when calling the API

{% hint style="warning" %}
Free Tier Projects run on shared infrastructure and might have some minute performance impacts. They are not meant to be used for Production use cases. [Please upgrade your Organisation](#upgrading-your-organisation) to create dedicated staging and production environments.
{% endhint %}

## Upgrading your Organisation

As your project grows, you may need to upgrade from the Free Tier to a paid plan. This guide walks you through the process of upgrading your Cosmocloud project, explaining what to expect and how to make the transition smoothly.

{% hint style="info" %}
Cosmocloud currently allows you to link your existing Databases in self service. If you need **dedicated databases created directly by Cosmocloud**, contact Cosmocloud Support. (<support@cosmocloud.io>)
{% endhint %}

### When to Upgrade?

Consider upgrading your project when:

1. You're consistently hitting the Free Tier API call limit (1000 calls/day).
2. You need to create multiple projects within your organization.
3. Your project is moving from development to production/staging
4. You need dedicated infrastructure for better performance
5. You require priority support for your growing team

### Upgrade Process

Follow these steps to upgrade your project:

1. Go to [Dashboard](https://dashboard.cosmocloud.io/) and open your Free Tier Project. On the top left, you'll see an `Upgrade` button.
2. Schedule a call with our team and the team would assist you from there onwards.

## FAQs

1. **Can I exceed the 1000 API calls limit if I'm willing to pay?** A: No, the 1000 API call limit is hard-capped for Free Tier projects. To increase this limit, you need to upgrade.
2. **What happens if I hit the API call limit?** A: Once you hit the limit, any further API calls will be rejected until the limit resets at 00:00 IST.
3. **Can I use the Free Tier for a production application?** A: While it's technically possible, we don't recommend using the Free Tier for production applications as it uses shared infrastructure and has hard limits applied.
4. **Is my data safe on the Free Tier?** A: Yes, we implement security measures across all tiers.
5. **Can I downgrade my plan?** A: Downgrade from High to Low Tiers are handles on case-by-case basis. Contact our support team to discuss your specific situation.
6. **What about my data during plan changes?** A: Your data remains intact during plan changes.


# Connecting with MongoDB Data APIs

On Free projects, Cosmocloud uses MongoDB Data APIs to connect to your database cluster instead of native connection pools / sdks. This is because the Free Projects are deployed on shared infrastructure while the Pro Projects, you get dedicated environments.

When [creating the Database Secret](/getting-started/3.-connect-your-database) on Cosmocloud, the platform uses the API keys shared to create the following resources **automatically** in your MongoDB Atlas account -

* We create a MongoDB App Services app named `cosmocloud-integration`.
* We enable Data APIs on the above app.
* We enable authentication via API-Key on the app, generate an API Key for the Cosmocloud platform to connect, and then store the same securely within Cosmocloud's vault.

## MongoDB App Services Pricing

As we are using Data APIs to connect to Cosmocloud on Free Tier, it gets billed under MongoDB App Services pricing.

MongoDB App Services **has a huge monthly free tier** which includes 1 million requests, 500 hours of compute and 10GB of data transfer free every month. Normally, as Cosmocloud allows only 100 API calls on Free Tier, you would not be exceeding this limit, but Cosmocloud does not track or limit this usage and you might incur some cost on MongoDB if you exceed this free tier limit.

## Performance Impact

As Cosmocloud is connecting your database over MongoDB Data APIs **on free tier**, there would be a slight (\~10-30ms) latency added to your Cosmocloud API calls. Therefore, it is not suggested to run your Production or even load test/stress test on Cosmocloud's free tier projects.

{% hint style="info" %}
Cosmocloud uses native Connection Pools (SDKs) to connect to your cluster in Pro Projects, eliminating any performance impact.
{% endhint %}


# Templates


# CRUD APIs

This powerful feature allows users to effortlessly create basic CRUD (Create, Read, Update, Delete) APIs for any database model. This functionality enables users to quickly generate endpoints to manage their data models without needing to write extensive code. By streamlining the development process, it allows for rapid setup and efficient management of data operations, saving time and reducing complexity for developers.

### Steps to create CRUD APIs from Template

* Navigate to the APIs listing page from Application Layer -> APIs.&#x20;
* Click on the **Create API** button on the top right corner.
* Select the **Browse Template** option from the dialogue box.
* Select the **Entity CRUD APIs** option.
* Enter the **Database collection**.
* Select the **APIs** to be created.
* Accordingly the **Models** to be created.
* Click on finish to generate the starter APIs and models.

{% hint style="info" %}
You can then customise and edit any APIs that are created via Templates

[*How to customise APIs*](/resources/apis)
{% endhint %}

The starter template that Cosmocloud provides contains six APIs and five models.

Initially, APIs and models will be created in ‘Draft’ state. You can edit them in the Workflow builder to add more customisations.

### GET

* This method allows you to retrieves a list of all items in the database.
* This method also supports pagination through `limit` and `offset` parameters.

  * **Limit:** Specifies the maximum number of items to be returned in a single request.
  * **Offset:** Specifies the number of items to skip before starting to collect the result set.

  <figure><img src="/files/8Ah4jC84bvvHaH5wVVZz" alt=""><figcaption></figcaption></figure>

### GET BY ID

* This method retrieves a specific item's details based on the provided ID.
* It requires the ID as a parameter to identify the item.
* It returns detailed information about the item, including all relevant fields stored in the database.

<figure><img src="/files/jHsUE46wRX98P7IE9YRB" alt=""><figcaption></figcaption></figure>

### POST

* This method allows the creation of a new item in the database.
* It requires item details to be provided in the request body.
* It validates the provided data to ensure it meets the required criteria before creating the item.
* It returns the ID of the newly created item.

<figure><img src="/files/Hy7eedo0svaxd3sKc31K" alt=""><figcaption></figcaption></figure>

### PUT

* This method allows to replace the existing item in the database with new item.
* It requires the item ID to identify the specific item to be replaced.
* It requires item details to be provided in the request body.
* It validates the provided data to ensure it meets the required criteria before creating the item.

<figure><img src="/files/sderh04uALDEKvatb4fw" alt=""><figcaption></figcaption></figure>

### PATCH

* This method allows partial updates to an existing item in the database.
* This method requires the item ID to identify the specific item to be modified.
* It requires only the fields to be updated to be provided in the request body, allowing for partial changes without affecting the entire item.
* It validates the provided data to ensure it meets the required criteria before applying the updates.

<figure><img src="/files/SKL9aIs4xJcqQoXhpdXh" alt=""><figcaption></figcaption></figure>

### DELETE

* This method allows the removal of an existing item from the database.
* It requires the item ID to identify the specific item to be deleted.
* It permanently deletes the specified item from the database.
* It returns a confirmation message indicating the successful deletion of the item.

<figure><img src="/files/TAF04DhyP2oNxuh1mpDa" alt=""><figcaption></figcaption></figure>


# Entity Search APIs

Entity Search APIs is a powerful feature that enables users to perform advanced search operations on their database entities using a specialised search index in MongoDB. This feature simplifies the development process and enhances user experience by providing:

* Fast and efficient retrieval of relevant data
* Optimised query performance
* Advanced search capabilities based on various criteria
* Simplified implementation of search functionality in applications

### Prerequisites

1. Created a Search Index in your database using either:
   * Cosmocloud's [Search Index](/resources/document-search/full-text-search/create-a-search-index) feature
   * Manual configuration in your MongoDB database
2. Familiarity with your data structure and fields you want to search on

### Steps to create APIs from Template

1. Navigate to the APIs listing page from Application Layer -> APIs.
2. Click on the Create API button on the top right corner.
3. Select the Browse Template option from the dialogue box.
4. Select the Entity Search APIs option.
5. Configure the following settings:
   * Select your environment
   * Choose the previously created Search Index
   * Select query fields (fields to be searched)
   * Select filter fields (fields for which unique values will be returned)
6. Click on finish to generate the starter APIs and models.

{% hint style="info" %}
You can then customise and edit any APIs that are created via Templates

[*How to customise APIs*](/resources/apis)
{% endhint %}

### Generated Components

* One API method: `_search`
* One Request Model

Initially, the API and the model will be created in `Draft` state. You can edit them in the Workflow builder to add more customisations.

### API Method: `_search`

* The `_search` method allows you to search fields based on the provided query.

#### Query Parameters:

| **Parameter** | **Description**                             | **Type** | **Required** |
| ------------- | ------------------------------------------- | -------- | ------------ |
| query         | Text to search on the selected query fields | String   | true         |
| limit         | Maximum number of records to return         | Number   | true         |
| offset        | Number of records to skip                   | Number   | true         |

#### Response

The API returns a JSON object containing:

* `data`: Array of matching records according to the query and selected query fields
* `count`: Total count of matching records
* `*_filters`: Sets of unique values for each selected filter field

  ```
  [
    {
        "data": [
            {
                "_id": "66a67446f6a373b76cae0c04",
                "title": "Complete Cosmocloud"
            },
            {
                "_id": "66a67585f6a373b76cb1ebe8",
                "title": "Try Cosmocloud"
            }
        ],
        "count": [
            {
                "totalCount": 2
            }
        ],
        "status_filters": [
            {
                "_id": null,
                "items": [
                    "PENDING",
                    "COMPLETE"
                ]
            }
        ]
    }
  ]
  ```

  In this example, the API was created with `title` as a query field, `status` as a filter field. The `query` value was `Cosmocloud`

<figure><img src="/files/83gQ1PeyFaYIvDKEVD5y" alt=""><figcaption><p>Search API</p></figcaption></figure>

### Best Practices

* Choose query fields wisely to balance search accuracy and performance.
* Implement pagination using `limit` and `offset` for better performance with large datasets.
* Regularly update your Search Index to reflect changes in your data structure.


# Fetch / Upload Media APIs

You can quickly start creating the APIs and models with the bucket name, utilising the starter Template. This helps you in auto generating convention based APIs and models for your object storage with greater productivity

### Steps to create APIs from Template

* &#x20;Navigate to the APIs listing page from Application Layer -> APIs.&#x20;
* &#x20;Click on the **Create API** button on the top right corner.
* Select the **Browse Template** option from the dialogue box.
* Select the **Fetch / Upload Media APIs** option.
* &#x20;Enter the **Storage account name**.
* Click on finish to generate the starter APIs and models.

{% hint style="info" %}
You can then customise and edit any APIs that are created via Templates

[*How to customise APIs*](/resources/apis)
{% endhint %}

The starter template that Cosmocloud provides contains three methods and models.

Initially, APIs and models will be created in ‘Draft’ state. You can edit them in the Workflow builder to add more customisations.

### UPLOAD

* This method allows you to upload your files in your object storage and returns a URL with fields to validate your file.
* This method also contains an optional expiresIn | Expiration time for presigned URL (in seconds)
* This internally uses a *Create Presigned URL node* in the API, which you can go and tweak if needed.

### GET

* This method allows you to retrieve your files from your object storage and returns a URL
* This method also contains an optional expiresIn | Expiration time for presigned URL (in seconds)

### DELETE

* This method allows you to delete your files from your object storage.

### Conclusion

If you want to know more about utilizing object storage APIs check out :

* [Using Object storage API to store file](/examples-how-to/how-to-upload-download-media-in-object-storage#using-object-storage-api-to-store-file)  &#x20;
* [Retrieving files from Object storage](/examples-how-to/how-to-upload-download-media-in-object-storage#retrieving-files-from-object-storage)
* [Deleting files from Object storage](/examples-how-to/how-to-upload-download-media-in-object-storage#deleting-files-from-object-storage)

<br>

<br>

\ <br>


# Examples - How To?

This section provides a list of **How To examples** which will help you ***build complex*** features and use cases on Cosmocloud.

{% hint style="info" %}
You might also want to checkout [Sample Tutorials](https://tutorials.cosmocloud.io/).
{% endhint %}

<table data-view="cards"><thead><tr><th></th><th data-hidden></th><th data-hidden></th><th data-hidden data-card-cover data-type="files"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>Making an external API call</strong></td><td></td><td></td><td><a href="/files/jXu7EyCoePbXlKPvvAYd">/files/jXu7EyCoePbXlKPvvAYd</a></td><td><a href="/pages/yEbY4ira2UTEb8ZFPyl7">/pages/yEbY4ira2UTEb8ZFPyl7</a></td></tr><tr><td><strong>Reusable Flows - SubFlows</strong></td><td></td><td></td><td><a href="/files/ElAAjauUhaWCyhn0keBF">/files/ElAAjauUhaWCyhn0keBF</a></td><td><a href="/pages/JAz1yROK0FIm6TPMnojz">/pages/JAz1yROK0FIm6TPMnojz</a></td></tr><tr><td><strong>Creating Custom Error Responses</strong></td><td></td><td></td><td><a href="/files/rrmcYUCSXcfoFigoIzIo">/files/rrmcYUCSXcfoFigoIzIo</a></td><td><a href="/pages/0r7Pm2tqDPEJbgP1tehW">/pages/0r7Pm2tqDPEJbgP1tehW</a></td></tr><tr><td><strong>Flow Builder - Building Conditional Logics</strong> </td><td></td><td></td><td><a href="/files/r4wnb7Caze09QEvo7m7L">/files/r4wnb7Caze09QEvo7m7L</a></td><td><a href="/pages/EtGdmgOaAss5sBSiNNZb">/pages/EtGdmgOaAss5sBSiNNZb</a></td></tr><tr><td><strong>Flow Builder - Utilising loops</strong></td><td></td><td></td><td><a href="/files/1noZzWqugLpqIX6v0CEW">/files/1noZzWqugLpqIX6v0CEW</a></td><td><a href="/pages/N8RCApbf0JV7wwfNZofQ">/pages/N8RCApbf0JV7wwfNZofQ</a></td></tr><tr><td><strong>Creating Dynamic Queries</strong></td><td></td><td></td><td><a href="/files/6glBHJ98YoLlRxje28J0">/files/6glBHJ98YoLlRxje28J0</a></td><td><a href="/pages/pdjSrzBnnr3Pt7ThTxXd">/pages/pdjSrzBnnr3Pt7ThTxXd</a></td></tr><tr><td><strong>Accessing Auth Tokens in APIs</strong></td><td></td><td></td><td><a href="/files/PSjvP3lGnScepUHmQWZ8">/files/PSjvP3lGnScepUHmQWZ8</a></td><td><a href="/pages/MguV8fUAsrVG11zyk3Qf">/pages/MguV8fUAsrVG11zyk3Qf</a></td></tr></tbody></table>


# Making an external API call

We often have the use case where we want to make an API call -- be it to another micro-service in your eco system or to a 3rd party service. Over here we'll see how to accomplish the same in Cosmocloud's Flow Builder.

## Using [API Call](/flow-builder/node-types/external-nodes/api-call) node

You can use the `API Call` node in the Flow Builder to connect to any external service and hit their API.

<figure><img src="/files/3PFNUguqXyaOiehmqz1z" alt=""><figcaption></figcaption></figure>

You can then open this node's properties and configure your API call you would want to perform. For example, if you want to fetch a list of students from `https://example.com/students` using a `GET` API call, you would configure it as per the below screenshot -

<figure><img src="/files/008sqnM6wyrJBtY166JU" alt=""><figcaption></figcaption></figure>

This node will return `body` and `statusCode` for you to use in the rest of your flow. For example, if the above `API Call` node has the nodename `node_7`, you can access the response body as `$.node_7.body.<key_in_body>`

You can also make `POST` and other calls, as well as JSON payloads and enable Authentication on this external API.

{% hint style="info" %}
To go deep into `API Call` node's documentation, please [check this link](/flow-builder/node-types/external-nodes/api-call).
{% endhint %}


# Reusable Flows - SubFlows

Many a times we need a common business logic to be implemented in multiple APIs and places, and we do not want to build this common logic from scratch every single time.

That's where [SubFlows](/resources/subflows) come into the picture, allowing you to define your custom common logic **just once** and then reuse it in multiple APIs or other SubFlows (just like a reusable function).

## Building SubFlows

You can build SubFlows in Cosmocloud, which accepts multiple **arguments** and can return a single **JSON** object - you can use different keys in the JSON object to return multiple objects at once.

{% hint style="info" %}
Checkout how to [create SubFlows here](/resources/subflows).
{% endhint %}

## Using [Execute SubFlow](/flow-builder/node-types/external-nodes/execute-subflow) Node

You can then use the `Execute SubFlow` node in Cosmocloud's Flow Builder, to call any created SubFlow in the system. You can also pass your arguments to this SubFlow call, as mentioned in the SubFlow documentation.

{% hint style="info" %}
Checkout how to use [Execute SubFlow node](/resources/subflows#how-to-use-subflow).
{% endhint %}


# Creating Custom Error Responses

Custom error responses can enhance user experience by providing clear and specific feedback. In this guide, we'll demonstrate how to create custom error responses using Cosmocloud's Flow Builder.<br>

### Step 1: Use the [Build Json](/flow-builder/node-types/variable-nodes/json/build-json-object)   node

The **Build JSON** node allows you to construct a custom JSON object for your error response.

1. Add the \*\*Build JSON\*\* node to your flow.

<figure><img src="https://lh7-us.googleusercontent.com/docsz/AD_4nXeI3jqe-stnS9pfB2qICs1J9DwgLvkaUiiX1vgP9655EXhngn2uA5U8-sZwv-0g6xwT8dLPIfS35G5Mi4JDUM8mq5sl57spEfSmDUkHKy-716x2BjfS_a9jT0Ddks_Okmptq4JpG1C_3SMtm4W8Uvv0nsoC?key=lioysNCrnRX1UpiKiuyFyw" alt=""><figcaption></figcaption></figure>

2. &#x20;Open the node properties.

<figure><img src="https://lh7-us.googleusercontent.com/docsz/AD_4nXeMQ67YfcH9maQJq2xcrFHBOcKYUVEgeTqabRPpL0SVsCM1AO7DL5WTtEMxfg5Kq0oj8F3jbhuqV-FqwygGfJvDRNls_dtADqhROzHFe2QkDAA27iP--t6KVFayrG8M4uzUgSZZ7iTXA287NG_1f7Q_C6GK?key=lioysNCrnRX1UpiKiuyFyw" alt=""><figcaption></figcaption></figure>

3. &#x20;Configure the name of the JSON object and its initial value. For instance, to return an error message `{'msg': 'record not found'}`, set the variable name to `errorResponse`.

<figure><img src="https://lh7-us.googleusercontent.com/docsz/AD_4nXcnvWkc626wqTQHdl8Gf2_CtqPbNCPS2kucHcPhwAanrqqC5VLGcN1aSiYMg1SMZnRYo9JeWyCIi8zW03Z2e18p-WoY1mtHoQaJiEiGihIY_O_N9zCpJ1a-MqwBLKCGyIRtXg44UNWRZoAo3PS6v4mkawiD?key=lioysNCrnRX1UpiKiuyFyw" alt=""><figcaption></figcaption></figure>

### Step 2: Use the HTTP Response Node

You can now use the custom JSON object in the HTTP Response node to send your custom error response.

1. Open the properties panel of the **HTTP Response** node.
2. Set the response value to `$.variables.<created variable>`. For example, use `$.variables.errorResponse`.
3. Select the corresponding status code from the drop-down menu, such as `404 - Not Found`.

<figure><img src="https://lh7-us.googleusercontent.com/docsz/AD_4nXeb_iHkTz5BoxdbFUdQdWeaNNO9ZBbzxxE78QLS3NgqqBwGxdQw8ZyU4PZyI6De3RKhdMNXdgZQdVxelmZMJ7eV37nLqF1VWVkPpujrfDsovi0Hbgp9iulmAiyguuAOGWdDHaDfNmERYQfKVhaXZhkzkLBo?key=lioysNCrnRX1UpiKiuyFyw" alt=""><figcaption></figcaption></figure>

<br>

This node now will return the response body as defined in the Build JSON node and the response status as 404.

<br>

<br>


# Flow Builder - Building Conditional Logics

## Utilising If/Else Node

In many scenarios, you need to execute specific instructions based on certain conditions. This is where If/Else nodes become crucial in Cosmocloud's flow builder.   &#x20;

Imagine you are building an API that determines user eligibility for a promotional offer based on their age. Here’s how you can implement this using If/Else node:

1. Select the If Else node.

<figure><img src="https://lh7-us.googleusercontent.com/docsz/AD_4nXfHYDDtqnmktYI10cWWgeLaQcLBaaNBDCN1PKbx9m-fnf2GpnYDDr5ZSvTTxjUBNWHgqlPn_ziDDu7SuoBoDB2RH2-OEwDUtKAohePtTar4gejyGh1kJfV9XNvkuU4_8yllu1QSnaTn4kJh4NyQH6WPqs4?key=3g19iCAD9aT3BbvyxuQRkw" alt=""><figcaption></figcaption></figure>

2. Click on the node to go to the properties panel of the node and click on edit condition to add the condition criteria for our If Else node. In our case, the criteria is to check whether the age of the user is greater than or equal to 18 or not.

<figure><img src="https://lh7-us.googleusercontent.com/docsz/AD_4nXd5aIKV1z4wznoDGx12AXutjZ5vt_gp8brWX2UV4iSaGohY7xxzKw2oUrH-OXfrKlbzHI-HF8EmtA8lMxB79SF2AnE6Wcyb_Ie3LigoBZ-vN0f5UFZv-qXdMFxGKT2Fd0t6lu6fjRrLFAoX0qUYUaHVbIMg?key=3g19iCAD9aT3BbvyxuQRkw" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
For creating more complex conditions, you can check [building conditions](/flow-builder/cql-cosmocloud-query-language/building-conditions).
{% endhint %}

3. Now, we can see a True branch and a False branch coming out of the node.&#x20;

<figure><img src="https://lh7-us.googleusercontent.com/docsz/AD_4nXc4XvWJQndJHJAxInEAtzOKClOkyF2R7OuzpgH_-bN3RhR6wHyllBjanWgJay-x3CSDBRKWR-CNBBmIPLjuKSdIseZfkvABBueuZRhs0Xu3P7Jl7NV0oUsJWJ8RBAXv0A5MMNGE50Fh_nWRmxTqupvFErk?key=3g19iCAD9aT3BbvyxuQRkw" alt=""><figcaption></figcaption></figure>

4. **TRUE Path:** If age is greater than 18, proceed to offer eligibility logic.
5. **FALSE Path:**&#x49;f age is 18 or less, send a response indicating the user is not eligible for the offer.

To learn more about the If/else node [click here](/flow-builder/node-types/conditional-nodes/if-else).

## API with Switch Case Node

In many scenarios, you need to execute different sets of instructions based on the value of a specific variable. This is where SWITCH/CASE nodes become crucial in Cosmocloud's flow builder.

Imagine you are building an API that processes different types of customer service requests. Here’s how you can implement this using SWITCH/CASE nodes:

1. Let's assume you are sending a `type` field through the query parameters and you want to execute different flows depending on the `type`.
2. First, select the switch case node and add it to your flow.

<figure><img src="https://lh7-us.googleusercontent.com/docsz/AD_4nXc9ilN8fMPZ7iCjpRkYwFVi_QaRfHauJbrjrJwzHs75YG2y3SfUreJhJYmCS1DXYBSrdMv_n8Y81h_Ww4GrKAHJkee5dq0OaxjYM10IaZ6bqVLEyBSMXbRR7aq9xNeC0K_3LX_DTloM66lKxpFXsMxi3lzr?key=3g19iCAD9aT3BbvyxuQRkw" alt=""><figcaption></figcaption></figure>

3. Now, configure the node as follows:

<figure><img src="https://lh7-us.googleusercontent.com/docsz/AD_4nXfAoPZjRnoHbhb8jj8A3EIDjFsUJNBBwvEXQ2KbG-QWY7vPCxzPtOkTWyMt-lzVbS325SA95bBeGPt60jcZnJJT-g-abs8uAIE9X0WIwla9wWP9zuxDqVgovWg7qF6nCsGStfU6nlbA6cGyqF_xIRhe_duH?key=3g19iCAD9aT3BbvyxuQRkw" alt=""><figcaption></figcaption></figure>

4. You now have 4 branches labelled as `billing`, `technical`, `account_management` and `default`. Here's how the flow looks now:

<figure><img src="https://lh7-us.googleusercontent.com/docsz/AD_4nXcLKwNpszW62m6cmQ85blOaBPTqShIFS0VITtx-CwFcgPecza8Arj_e3f7CN3PoeL0aAKsnUluut-xWjTXB1hFXpxTRZR3aM8i_BHzgEU5a0Q339aivEFz2nLzIlwC5-mLBY5lDJaVOU_Qo05kBbTT--boX?key=3g19iCAD9aT3BbvyxuQRkw" alt=""><figcaption></figcaption></figure>

5. Now let's return a unique response for each type of request i.e., if the type in the query parameters is `billing` we execute the billing branch and return `You are in the billing branch` as the response.
6. Similarly , add a unique response for other branches as well. This is how the flow looks like:

![](https://lh7-us.googleusercontent.com/docsz/AD_4nXdDyi01eZ0VDWozqiOCn60QMNEs32_SJN9pfsQaUXf3M-i6i3DQLbaaUhMwkljkQP4WEItpQOk2hjhtqHqL6Lbyn9cS58uv7AUIUeSILG7J1zdU5q6kZu1lTCLHocuyes827vCTP_38Jz_xTdOArKiUFkw3?key=3g19iCAD9aT3BbvyxuQRkw)

7. Now let's test this API.

<figure><img src="https://lh7-us.googleusercontent.com/docsz/AD_4nXdAlMTAbLomAjj9mOK0kXx0VO67qo2HfG4JvtMRCflhZ0_aKOGkn2AY44zx2sL9mMsgDecRhM0Isj8I-dKq9epMqDbgy7PKvknwPrGDRi1hXWX3QzCZNBG2pPbkx1XCApoD-rebSA1FxDxC0P7uCHX_StXC?key=3g19iCAD9aT3BbvyxuQRkw" alt=""><figcaption></figcaption></figure>

<figure><img src="https://lh7-us.googleusercontent.com/docsz/AD_4nXc3jPbniv44SJGpGPZVQOY7rdD6YpBj8vV07nUXQ7QjF2itXhbSzVfO5eMIIdbg9AegLQv5R10CBeGhD3E6oqRVvTDXv5_dZUofPP6kvL12_VNhP0g8VpZ07Hzo9RlWw4-5gvunSB8OOapzdf-9IEG52sgl?key=3g19iCAD9aT3BbvyxuQRkw" alt=""><figcaption></figcaption></figure>

<figure><img src="https://lh7-us.googleusercontent.com/docsz/AD_4nXfHR67ySSSXbBVYtF67tcBE8N8gzf_dIrutos3SqN-ajrPBB5g-duwPCBbHcxWH8vqBGGEQeud7CjqfOKHTA6VWrwnewcvO8xwRryVxJWfTBpHNI21nmET67Ees6PaEw1A4B92P4plY8CgTkFplN-a3-ox3?key=3g19iCAD9aT3BbvyxuQRkw" alt=""><figcaption></figcaption></figure>

To learn more about the Switch Case node [click here](/flow-builder/node-types/conditional-nodes/switch-case)

<br>

<br>


# Flow Builder - Utilising Loops

## Working with FOR Loop Node

In many scenarios, you need to iterate over a collection of items and perform specific actions for each item. This is where FOR loop nodes become essential in Cosmocloud's flow builder.

Imagine you have a list of marks scored by a student and you want to calculate the total marks scored by the student. Here's how you can do it in Cosmocloud's flow builder:

### Assumptions

* You already have an API configured and a request body model configured with it which accepts `marks` as an array of floats.

<figure><img src="https://lh7-us.googleusercontent.com/docsz/AD_4nXfURVsSp0Ic_8TR-TjMoeM_1g5x9pLLN77kRHqPvWN1G3JqDUfUDPr1X3LLQQY6FFs1hiIOSMim3QSWoFD-cYihTpvVJGl2LyfnjY883vmUclagl-8SzopldZ1HslZi2Teqv7yrwB9oXMKNFdWyTpyOHj2l?key=3g19iCAD9aT3BbvyxuQRkw" alt=""><figcaption></figcaption></figure>

* To learn about how to set up APIs [click here](/resources/apis).
* To learn about how to set up a request body model[ click here](/resources/models/building-models)

Now, let's  see how we can leverage the for loop node for iterating through the array of marks and getting the total marks of the student.

1. Click Add Node, and select the `Length of Array` node. This will help us get the length of the array which will be useful for iterating through the loop. Configure this node with a variable name of `len` and pass in the array for which we need the length, as shown in the figure below.

<figure><img src="https://lh7-us.googleusercontent.com/docsz/AD_4nXfWqy4L9r-L1DdxLo9qI3NUm4M4hnwJuaAw7ErE-bv-Nrcby3G_G_Z7_d556x73CHbfety5zWzZDRD478hiMeQm9Ut5_NG723IJqc8mvDxzblcUwl5sSqbIg9PUVjakm8GRfp0zDPX3CjhyxDRT2QeapYO7?key=3g19iCAD9aT3BbvyxuQRkw" alt=""><figcaption></figcaption></figure>

2. Now lets add a `Set Variable` node, this variable will be our iterator and help us fetch the marks at different positions in the array. Configure this node as shown in the figure below.

<figure><img src="https://lh7-us.googleusercontent.com/docsz/AD_4nXenY6FzDTcYVlFkMerARM0urvnpRcb_YWKTTVl2xA01ADZoVFlCVc5km9N3gN4HrnNU3JJ9QBUAgqkbo2WpqBgzHuYMR2wAdJOgw3bFo50Ha6M21W071BFq9XB7q3YR495ejpjk6KfRaNWfZ1gin8fqgPPI?key=3g19iCAD9aT3BbvyxuQRkw" alt=""><figcaption></figcaption></figure>

3. Now let's add the `For Loop` node to iterate through the marks array. To configure this node we need to specify the variable we will be using to loop through the array, the condition when we want to get out of the for loop and the increment factor by which our variable should be incremented after each iteration. Configure the `Variables to use` field and the `Increment factor` field as shown in the figure below.

<figure><img src="https://lh7-us.googleusercontent.com/docsz/AD_4nXddQDwyvCL1a-gSFyXkYYnbE6FDi0ujitiDzAOFZo1ftYD4lVAsKL9buCxMgMkAgFI8ciVBL1_TF8ECnyHVPchBLBgmlYYt6PING3LjwlorxHWcpWqbMyw9aiOfwWfT9ibv9ffJwCzg6nztP_TKUnantRY?key=3g19iCAD9aT3BbvyxuQRkw" alt=""><figcaption></figcaption></figure>

4. Now let's add the condition, click on the `Edit condition` button and inside the JSON editor add the following condition.

<figure><img src="https://lh7-us.googleusercontent.com/docsz/AD_4nXe80PLx3tMAJdzcZij6yQKIaOUSO6wcHXG7A9gnk4N7t-zZzq2claXrZ8wIvEY6zS7KY2fVS3v79ljHomt7dCW2rXIwM-u4pSxoaDvN892AwyCUMNOLOUvz5CB0irfLr3ewGDUgT2cqbxJPV82yaBIG9c0T?key=3g19iCAD9aT3BbvyxuQRkw" alt=""><figcaption></figcaption></figure>

5\. Let's get inside the for loop click on the `Get inside` icon. You now are inside the for loop's flow and we will now create a flow here which we want to execute inside the for loop.

<figure><img src="https://lh7-us.googleusercontent.com/docsz/AD_4nXdh4MA5QMAd0NLOJvtQUb-NcRR9uktoe8Ga5PToP6idvOFa7n3bBFdM4WX4abBDa2s2R0SuJZ4_BEPr1On3EfMuBKXHuKqMCuX0ybcQec8wLcJi62a4tqBxj3KpYZJyEfrwSCneuudvjDngtsGzfA_lrrg?key=3g19iCAD9aT3BbvyxuQRkw" alt="" width="375"><figcaption></figcaption></figure>

6. Here we first use the `Get Array Item` node to get the item at a particular index, let's name it item.

<figure><img src="https://lh7-us.googleusercontent.com/docsz/AD_4nXdCDh9_YoibHjuB7Xe4CJpEtTsWTQ43faFuAikN8d5l42j8e1WfMG27tosQ_wfRCUp__xII1CtagYCWRU4h4BYLnkhpXh9c5nuGsz_Ym3E09098AVeKBEZqKWNSEqlvCNgExQEIfRlsPZnLabtqGxhUM8f4?key=3g19iCAD9aT3BbvyxuQRkw" alt=""><figcaption></figcaption></figure>

7. Now that we have the item, let's add it to our variable total using the \`Add Variable\` node.

<figure><img src="https://lh7-us.googleusercontent.com/docsz/AD_4nXdbCqkwo19L_BBYcahU8Phv9CUr0AVokloePd9oNZ7qsIG1D4dU8gkw9t5W0WHAV5Q7a0mYYbVJfwFjgXY_SpAF8RcnghFOjeS_YUpy0LMmNw-YC8J8RRA5OmcnV25Om2RrFahpOXs0qSBFhk9qBINArqkC?key=3g19iCAD9aT3BbvyxuQRkw" alt=""><figcaption></figcaption></figure>

8. &#x20;This is what our flow inside the for loop look like:

<figure><img src="https://lh7-us.googleusercontent.com/docsz/AD_4nXeFEsAScce16VMy9VLS95GofTAEdsXC9lCzpeyVNMNZRD5aI4sbuU0MWvauoDFejBYTpVg1AioL9hFm1dky7pqWHBL5IaPrJrG2I2Y99jCoZDMpmvtPip5m4O7HNSnaYSCjAgXFGRi93F5R0qATqBCcVZqq?key=3g19iCAD9aT3BbvyxuQRkw" alt=""><figcaption></figcaption></figure>

9. Finally, let's return the total marks scored by the student by configuring the \`HTTP Response\` node as follows:

<figure><img src="https://lh7-us.googleusercontent.com/docsz/AD_4nXdU_PdS-VyUEUwXOp9M6AEcvpi95I3Ft2qDTKiAs3g5Q8w4jrEX8UYNN7nKhV7M5O0XG7Pt6fRq-WMM9XxxWQ-V2bkippnOEAprSRqG24phu0p5PqWR_6vnxa_5BmHAGss8wvb61xb3QbUhZCjKr3ZSKmVd?key=3g19iCAD9aT3BbvyxuQRkw" alt=""><figcaption></figcaption></figure>

10. This is what our entire flow look like:

<figure><img src="https://lh7-us.googleusercontent.com/docsz/AD_4nXdjf_LpcDG8r4sGdRCuSGDHk6nFI8vptGBf60He9m0Z-CDuDQRrnxmbwXYqTzvapA96Z2j7XwYf9OP_UNcVbM202Zamie94tmCVIYGRWV7SMa5tGsWVo6zGE7nmezqkNG8IigDoLcrpPDwcjA4j0g7upNzA?key=3g19iCAD9aT3BbvyxuQRkw" alt=""><figcaption></figcaption></figure>

11. Let’s now hit this API with postman.<br>

    <figure><img src="https://lh7-us.googleusercontent.com/docsz/AD_4nXcpTQORAEyRc4jqQHv8XIG2fjtcfh93cE4DPV4t0d2kO8dPWiUrHr0qCFLLDk58naAjotDwCvEbg4rp_cWRjUHscVUwFmfOc32L0MiM8GlhON4FVLjniEHDoImsg86NA0iR7Hj4luQqd-iAM1j-p_B-Kx3q?key=3g19iCAD9aT3BbvyxuQRkw" alt=""><figcaption></figcaption></figure>

To learn more about the For Loop node [click here](/flow-builder/node-types/loop-nodes)

<br>


# Creating Dynamic Queries

## Method 1: Using $buildMap Operator

The $buildMap operator is a dynamic JSON object builder that allows for conditional key-value pair insertion based on specified conditions. This is particularly useful for creating query objects for databases or APIs where certain parameters may be optional.

### Step-by-Step Guide

* **Define the Conditions** : Identify the conditions under which you want certain key-value pairs to be included in the query object. For instance, you might want to include a key only if a certain query parameter is present and meets specific criteria.
* **Create the $buildMap JSON Object**: Use the `$buildMap` operator to define your conditions, keys, and values.

### Example

Let's create a query object that includes name, jobTitle, and age based on the presence and values of these parameters in the request. &#x20;

```typescript
{
  $buildMap: [
    {
      condition: {
        '$.request.queryParams.name': {
          $neq: null,
        },
      },
      key: 'name',
      value: '$.request.queryParams.name',
    },
    {
      condition: {
        '$.request.queryParams.jobTitle': {
          $neq: null,
        },
        key: 'jobTitle',
        value: '$.request.queryParams.jobTitle',
      },
    },
    {
      condition: {
        '$.request.queryParams.age': {
          $ge: 10,
        },
        key: 'age',
        value: '$.request.queryParams.age',
      },
    },
  ],
};
```

### Explanation

* The condition field contains a JSON object that defines the condition.
* &#x20;The key field specifies the key to be inserted in the query object if the condition is met.
* &#x20; The value field specifies the value to be assigned to the key.

### Example 1

Assuming `name` and `jobTitle` are not null and \`age\` is less than 10, the resulting JSON object will be:

<pre class="language-typescript"><code class="lang-typescript">{
  "name": "$.request.queryParams.name",
<strong>  "jobTitle": "$.request.queryParams.jobTitle"
</strong>}
</code></pre>

Note: The `age` key gets omitted as the condition we had specified was to include the key when age is greater than or equal to 10.

### Example 2

Now, let's assume that \`name\` is not being passed as a query parameter and therefore is `null`. We pass `jobTitle` as intern and `age` as 24.

The resulting JSON object will be:

<pre class="language-typescript"><code class="lang-typescript">{
<strong>  "jobTitle": "intern",
</strong>  "age": 24
}
</code></pre>

<br>

To know more about the **$buildMap** operator [click here](/flow-builder/cql-cosmocloud-query-language/building-expressions/usdbuildmap).

## Method 2: Using the buildMap Node

The buildMap node is used to create a new JSON object with optional key-value pairs based on specified conditions. This method is similar to the $buildMap operator but is implemented without using the operator.

### Step-by-Step Guide

1. Add a buildMap Node: Select the buildMap node to add it in your workflow.
2. &#x20;Configure the Node:
   1. &#x20;**Variable Name** : Specify the name of the JSON variable that will be created.
   2. **List of BuildMap Objects**: Click on Edit and define the list of buildmap objects, each containing a condition, key, and value.

### Example

Here's how you might configure the buildMap node to achieve the same result as the $buildMap operator example:

```typescript
 [
  {
    condition: {
      '$.request.queryParams.name': {
        $neq: null,
      },
    },
    key: 'name',
    value: '$.request.queryParams.name',
  },
  {
    condition: {
      '$.request.queryParams.jobTitle': {
        $neq: null,
      },
    },
    key: 'jobTitle',
    value: '$.request.queryParams.jobTitle',
  },
  {
    condition: {
      '$.request.queryParams.age': {
        $ge: 10,
      },
    },
    key: 'age',
    value: '$.request.queryParams.age',
  },
];
```

To know more about the **buildMap** node [click here](/flow-builder/node-types/variable-nodes/special/build-map).

\ <br>


# Accessing Auth Tokens in APIs

You would have often faced times where you need to read the access token / auth token and read some certain values from the same (such as `user_id`).

To do this, we would first need to configure authentication in Cosmocloud and define the schema of the decoded token - mentioning what parameters can be expected in the token.

## Defining the token schema in Authentication Secret

While creating or updating the Authentication Secret, you can define the schema of the token there itself. For example -

<figure><img src="/files/HxchXlodYcDYYrLN4rX2" alt=""><figcaption></figcaption></figure>

As you can see above, our auth token can have fields such as `sub`, `orgId`, `name` and `age`. We say that `sub` is the field where the user's ID would also be present, hence we add `sub` to `User Id Key` field as well.

{% hint style="info" %}
For more details on how to configure Authentication and how to define the decoded token schema, please check this link.
{% endhint %}

## Accessing token properties in Flow Builder

Now, once we have defined the schema of our token in our Authentication Secret, we can now access these in our Flow Builder using [Magical Autocomplete](/flow-builder/cql-cosmocloud-query-language/magical-autocomplete), such as - `$.tokenData.sub`

### Token Properties

You can access any token property you set in the secret using the format - `$.tokenData.<key_name>`.

You can also access the **raw token**, sometimes useful to pass to another API call, using the syntax - `$.tokenData.rawToken`


# How to upload/download media in Object Storage

Using Object storage API to store file

After creating the APIs for the Object storage through API templates, you can start uploading your files directly to the bucket using the UPLOAD API.

### Steps to Upload a File in Bucket

* From your client / Front-end, make a POST request to your UPLOAD API endpoint, with the following

<figure><img src="/files/8dhtg4clpuGgipy4ePLk" alt=""><figcaption><p>add the name of the file with extention and the size in bytes to your req body</p></figcaption></figure>

<figure><img src="/files/Ui7aqfgPvcHIEgisQpod" alt=""><figcaption><p>you'll need to add your enviromentId and projectId to your headers</p></figcaption></figure>

* This request will then generate a **Presigned URL** and a set of form values that can be used to upload the file. Using the URL and form values, upload your file to the bucket.
* After successfully uploading the file, you can make a GET request to the Object Storage DOWNLOAD API to retrieve the file.

{% hint style="info" %}
file name (with extension; i.e - jpg,mp3,mp4 etc.) and file size (exactly in bytes) as request body.
{% endhint %}

## Retrieving files from Object storage

After successfully uploading the file in the bucket, you can retrieve the file by making a GET request to the API with the name of the file as a query parameter from your client, make a GET request to your DOWNLOAD API endpoint with the file's name to retrieve as a query param.

* That request will then generate a URL that can be used to download/access the file.

<figure><img src="/files/j85DPvwebXr6v1Zd8HUj" alt=""><figcaption><p>make a get request with enviromentId and projectId as headers </p></figcaption></figure>

## Deleting files from Object storage

Sometimes we have files that are not being used anymore and take up the space in our bucket. In such a case, we can utilize the DELETE method to remove the file from the bucket.

* To Delete files/files from your bucket make a DELETE request from your client with an array of strings as the request body with the name “objects to delete”.

<figure><img src="/files/nN4AC8JIdYpp3HSofo6n" alt=""><figcaption></figcaption></figure>

<br>


# Resources

In addition to creating APIs, Cosmocloud brings a bunch of cool features to the table. Let's give you a quick tour without diving too deep into the technical stuff.\
\
Here are some articles we've introduced in this section :&#x20;

<table data-card-size="large" data-view="cards"><thead><tr><th></th><th data-type="content-ref"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><h3>API's</h3><p>Explore the world of APIs and discover how Cosmocloud empowers you to create APIs effortlessly within minutes. <br><br><a href="/pages/PidqWug1FJOtVypWHKkN">Learn More -></a></p></td><td></td><td></td></tr><tr><td><h3>Environments</h3><p>Optimize your development workflow and boost developer productivity using environment management.</p><p><br><a href="/pages/t3LolmCrj8qaLx0LWd54">Learn More -></a></p></td><td></td><td></td></tr><tr><td><h3>Models</h3><p>Effortlessly craft your model schema with just a few clicks, simplifying the process of creating complex models .<br><br><a href="/pages/dQQ0ZXm2Yjb8Xln6GErE">Learn More -></a></p></td><td></td><td></td></tr><tr><td><h3>Secrets</h3><p>Enhance security and organization by safeguarding your environment variables through the use of secrets.<br><br><a href="/pages/MxOvbOhygOQJr7hCs6NJ">Learn More -></a></p></td><td></td><td></td></tr><tr><td><h3>User Management</h3><p>Invite teammates and simplify collaboration and streamline management for a smoother team experience.<br><br><a href="/pages/aZndJtZTFCv9o8PAY1ix">Learn More -></a></p></td><td></td><td></td></tr><tr><td><h3>Full-text search</h3><p>Explore full-text search, uncovering how indexes and analyzers work together to enhance your search experience.<br><br><a href="/pages/tWJbm2v27yrLuoEwJJyO">Learn More -></a></p></td><td></td><td></td></tr></tbody></table>


# APIs

REST APIs are the essence of Backend Development, the most used way for your frontend (client) to talk to your backend layer.

## Creating APIs

There are various ways to create APIs in your Cosmocloud project -

* [Using Templates](#using-templates)
* [Building from Scratch](#building-from-scratch)

### Using Templates <a href="#using-templates" id="using-templates"></a>

You can quickly start creating the APIs and their corresponding models using use-case based Templates. These help you in auto generating convention based APIs and models for faster productivity.

You can then [customise](#customising-api-flow-logic) and edit any API or Model that is created via Templates.

#### Available Templates <a href="#available-templates" id="available-templates"></a>

* Entity CRUD APIs
* Entity Search APIs
* Fetch / Upload Media APIs

### Building from Scratch <a href="#building-from-scratch" id="building-from-scratch"></a>

This is the method where you can start building your APIs from scratch. This will help you in customising your API endpoints, request methods as well as any [Query Param](/resources/models#query-params-model) Models / [Request Body](/resources/models#request-body-model) Models you want to use.

## Customising API Flow Logic

After creating an API, you can create or customise the APIs logic, using Cosmocloud's [Flow Builder](/flow-builder). To be able to customise this -

1. Navigate to APIs listing page from **Application Layer -> APIs**.
2. Open the API you want to edit.
3. Switch to the **Flow** tab of the particular API.
4. Start editing!

{% hint style="info" %}
Checkout Cosmocloud's [Flow Builder](/flow-builder) for more details on customising flows in Cosmocloud.
{% endhint %}

<table data-card-size="large" data-view="cards"><thead><tr><th></th><th data-hidden></th><th data-hidden></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>Creating Flows</strong></td><td></td><td></td><td><a href="/pages/8z0rUKU7stKO2y2rf6fw">/pages/8z0rUKU7stKO2y2rf6fw</a></td></tr><tr><td><strong>Magical Autocomplete</strong></td><td></td><td></td><td><a href="/pages/RJ2ouQTCjKiUMsBHftne">/pages/RJ2ouQTCjKiUMsBHftne</a></td></tr><tr><td><strong>Node Types</strong></td><td></td><td></td><td><a href="/pages/dG5YfkRM4ULDTeTC9n14">/pages/dG5YfkRM4ULDTeTC9n14</a></td></tr></tbody></table>


# Checking Logs

Cosmocloud offers the **Logs** feature to user for easy debugging and development process. User can navigate to `Logs` tab present in `Application layer`  to check logs.

## Exploring Log table&#x20;

Let us see what values are displayed in `Log table` in cosmocloud.

<figure><img src="/files/LJTEe6aTiTYVDtaSWHCs" alt=""><figcaption></figcaption></figure>

1. **Timestamp** : It displays API call request time
2. **Request Id :** It is unique ID assigned to each API request call. Multiple Logs having same request ID means that all of those logs are received for same API call.
3. **Log Type** : It specify what type of information log holds for a specific API call. In image provided above both logs are for same API calls. One holds `REQUEST` information log e.g. endpoint,headers, request body etc. whereas one holds `RESPONSE` information  e.g. response data etc.
4. **Log Level** : It specify the logs level for e.g. `DEBUG`, `INFO` , `ERROR` etc.
5. **Endpoint** : It specify the endpoint for API from which logs are received.
6. **Method** : It specify the API call method type

## Environment specific Logging

You can access API logs for specific environments using toggle present at top of `Log table`

<figure><img src="/files/ffInaDNvSVDHGIZElBeC" alt=""><figcaption></figcaption></figure>

Just select the environment you want to see the `Logs` for and you are good to go.

## Using Debug node&#x20;

To utilise the `Logs feature` to the fullest we have provided `Debug node` which helps you to print values in the logs.

<figure><img src="/files/CBKNebSbYaSPYkkLrF1f" alt=""><figcaption></figcaption></figure>

We can use this node to print values to the `Logs`. Let us assume we have a variable of type dict declared at top of our API  flow and i want to check if values in it are correct. We can use debug node for same.

<figure><img src="/files/DrtwCpiCahY9MY4wLWyU" alt=""><figcaption></figcaption></figure>

When you make an API call for same flow you will receive logs as specified below<br>

<figure><img src="/files/SLB4V7cCTJay3PXwH0lS" alt=""><figcaption></figcaption></figure>

Now as you can see, Apart from `REQUEST` and `REQUEST` you are now also receiving `DEBUG` log for same API call as well. when you click on **View** you will be able to see debug values.

<figure><img src="/files/ZIViJ0mS6fpabDGhrb3e" alt=""><figcaption></figcaption></figure>


# SubFlows

SubFlow in cosmocloud provides modular approach to build reusable piece of flow. It helps you to build a piece of code once and plug it in existing flow.

## Create SubFlow

* Navigate to **Application Layer -> SubFlows** in your Cosmocloud project.
* Click on **Create SubFlow** button
* Add your SubFlow name as well as add the **Arguments** your SubFlow will receive from the calling Flow (an API or other SubFlow).

## Understanding Arguments

<figure><img src="/files/Px5SAPczMcNI4SLoJDou" alt=""><figcaption></figcaption></figure>

* **Toggle :** This is used to mark if argument is `required` or `optional`
* **Argument key :** argument name to be received
* **Argument type :** It specify what type of value is expected
* **Default :** It specify default value if user didn't enter value. (optional)

## How to use SubFlow

SubFlow in cosmocloud is an isolated component which means  every value that you want to access in SubFlow needs to passed as an argument.

#### Understanding SubFlow node

* To execute this SubFlow in an existing API, you can use `Execute SubFlow` node&#x20;

<figure><img src="/files/ACxWgEcDdL94YOA4R9Iv" alt=""><figcaption></figcaption></figure>

* You need to select the SubFlow which you need to execute and also pass required arguments.

<figure><img src="/files/J1JghaqiByvfc11UFK7l" alt=""><figcaption></figcaption></figure>

* Arguments will be passed in as keys and values. These values are case sensitive so make sure enter correct terms.

<figure><img src="/files/YMb7gVsCbJOLONHuDUrN" alt=""><figcaption></figcaption></figure>


# Models

A model refers to a blueprint or definition that outlines the structure and constraints of a data model. It provides a set of rules and specifications for how data should be organised and stored within a system.

There are 3 types of Models in Cosmocloud right now -

## Database collection model

These define and mirror the database collections (tables / entities) in the system. The name of these models should be exactly the same as the underlying Database collection.

{% hint style="info" %}
You can check the `database model` naming convention [here](https://www.mongodb.com/docs/manual/reference/limits/#mongodb-limit-Restriction-on-Collection-Names). You can easily define these as strings containing \[a-zA-Z0-9\_] characters and ***cannot*** begin with numbers or underscore.
{% endhint %}

## Query params model

Query param models, are structures or schemas that define the expected format and data types of query parameters used in API calls. They serve as a set of rules that guide how query parameters should be constructed and what types of values they should hold when making requests to an API.

## Request body model

A "Request Body Model" is a structured definition that outlines the format, structure, and data types expected in the payload of an HTTP request made to an API endpoint. It serves as a blueprint for using HTTP methods like POST, PUT, PATCH, and DELETE. Unlike GET requests that retrieve data, these methods involve sending data to the server for processing .

{% hint style="warning" %}
Request Body has an option set as \`extra\_fields=forbid\` which makes your request bodies strict. Any extra field passed while calling the API, would lead to 400 Bad Request with appropriate error message.
{% endhint %}


# Building Models

## Understanding requirements

Let us assume we have a student data with given Schema that we need to store in database :&#x20;

```javascript
{
    "id":{
        "type":"objectId",
        "required":true,
    },
    "name":{
       "type":"string",
       "required":true,
    },
    "age":{
        "type":"number",
        "required":true,
    },
    "subjects":{
        "type":"string[]",
        "required":true,
    },
    "address":{
        "city":{
            "type":"string",
            "required":true,
        },
        "state":{
            "type":"string",
            "required":true,
        }
    }

}
```

To build the model with given schema above follow these steps :&#x20;

1. Navigate to Models screen from **Application Layer -> Models**.
2. Click on **Create Model** button and configure models name, description and model type as per your preference. For instance, if you would like to build the Student's DB model above, you can select **Database Collection** model type. You can check other [<mark style="color:blue;">**model types here**</mark>](/resources/models).
3. After model is created navigate to **Schema** tab on top of model details page.
4. You can now start building your model's schema.

Models schema for above requirements would appear something like this :&#x20;

<figure><img src="/files/eGUyTRMWsw0r2TvHqIcm" alt=""><figcaption><p>model schema</p></figcaption></figure>

## Supported data types in schema builder

* **ObjectID**: An ObjectID is a unique 12-byte identifier typically represented as a hexadecimal string. These are used to uniquely identify documents in a collection. This can also be used when making references to other IDs of other collections (for ex. a record in *Orders* collection could have a `userId: ObjectId` )
* **Boolean**: Boolean is often used to express binary decisions or states i.e. True or False.
* **String**: A string data type represents text. It can contain letters, numbers, symbols, and spaces. Strings are used to store textual information.
* **Integer**: An integer data type represents whole numbers, both positive and negative, *without floating points*.
* **Float**: A float data type represents decimal numbers. Unlike integers, floats can have fractional parts. They are used for calculations involving real numbers.
* **Nested**: The "Nested" type typically refers to nested or embedded structures within a data model. Unlike Dict it has a defined schema.
* **Array**: An array is a collection of elements of the same data type, ordered by an index. These are used to store multiple values in a single key.
* **Dict**: A dictionary is a collection of key-value pairs. This is different from Nested, as a Dict is a open ended object and can accept any sub fields, whereas Nested has a defined schema.

{% hint style="info" %}
Some model types have restrictions of types of properties you can use. For for more information, [<mark style="color:blue;">**please check here**</mark>](/resources/models).
{% endhint %}


# Environments

Environments are a set of deployed infrastructure to be used by the Project at runtime. One single Environment can be thought as a single Deployed Infra capable to live and scale on its own.

## Development Environment

Each project can have 1 environment of type **DEVELOPMENT** which will be used in Dev Mode, to test and try out the APIs being built.

{% hint style="info" %}
Currently, this Development Environment is free to use, with Free Tier restrictions applied on it.
{% endhint %}

## Dedicated Environments

You can create additional environments in Cosmocloud, as per need. There are 3 types of environments you can create -

### Production Environment

This environment is supposed to act as your Project's Production environment. This environment also acts as a **releasable environment**. You can select the Environment Tier on which the Environment runs and scales out to.

#### Restrictions & Limitations

* You cannot rename this environment.
* You cannot share this environment.

### Staging Environment

This environment is supposed to act as your Project's Staging / Testing / UAT environment. This environment also acts as a **releasable environment**. You can select the Environment Tier on which the Environment runs and scales out to.

#### Restrictions & Limitations

* You cannot rename this environment.
* You cannot share this environment.

### Custom Environments

You can create multiple custom environments, as per need. Each Custom Environment can have a unique name as well as you can define the Environment's tier type as well.

#### Coming Soon

* You can also make these environments sharable so that you can share the infrastructure between multiple environments and still have logical name spacing.
* You can connect custom domains to these environments.


# Environment Tier Types

An Environment's **Tier** tells Cosmocloud the expected scale and resources needed for that environment. A combination of Vertical Scaling or Horizontal scaling can be used to get your required tier.

{% hint style="info" %}
Autoscaling is currently a per-request feature, please reach out to [<mark style="color:blue;">**Cosmocloud Support**</mark>](mailto:support@cosmocloud.io) if you need it.
{% endhint %}

## Vertical Scaling

You can vertically scale your applications from switching from one Tier type to another where you have more CPU and RAM resources available -

| Tier Type | Resources              | Description                                                                      |
| --------- | ---------------------- | -------------------------------------------------------------------------------- |
| Shared    | Shared CPU & RAM       | Meant for trials, POCs and testing environments.                                 |
| Low       | Dedicated vCPU and RAM | Meant for low traffic web apps with small scale or staging environments.         |
| Power     | 2x resources than Low  | Meant for medium to high traffic applications for production ready envrionments. |
| Boost     | 4x resources than Low  | Meant for High CPU and RAM utilisation for heavy resources and heavy load.       |

## Horizontal Scaling

You can increase the number of instances per tier type when you need to horizontally scale your application environment. The configurations available are -

{% hint style="info" %}
For actual pricing based on Cloud Provider and Region, please [<mark style="color:blue;">**check this page**</mark>](https://cosmocloud.io/pricing).
{% endhint %}

<table data-full-width="true"><thead><tr><th>Tier Type</th><th>Tier</th><th>Instances Scale</th><th>Max # of API calls (per day)</th><th data-type="checkbox">High Availability</th></tr></thead><tbody><tr><td>Shared</td><td>(S0) Shared-0</td><td>Shared, 1x</td><td>1000</td><td>false</td></tr><tr><td>Shared</td><td>(S1) Shared-1</td><td>Shared, 3x</td><td>3000</td><td>false</td></tr><tr><td>Shared</td><td>(S2) Shared-2</td><td>Shared, 5x</td><td>5000</td><td>false</td></tr><tr><td>Low</td><td>(L0) Low-0</td><td>1x</td><td>No cap</td><td>false</td></tr><tr><td>Low</td><td>(L1) Low-1</td><td>3x</td><td>No cap</td><td>true</td></tr><tr><td>Low</td><td>(L2) Low-2</td><td>5x</td><td>No cap</td><td>true</td></tr><tr><td>Low</td><td>(L3) Low-3</td><td>7x</td><td>No cap</td><td>true</td></tr><tr><td>Power</td><td>(P0) Power-0</td><td>1x</td><td>No cap</td><td>false</td></tr><tr><td>Power</td><td>(P1) Power-1</td><td>3x</td><td>No cap</td><td>true</td></tr><tr><td>Power</td><td>(P2) Power-2</td><td>5x</td><td>No cap</td><td>true</td></tr><tr><td>Power</td><td>(P3) Power-3</td><td>7x</td><td>No cap</td><td>true</td></tr><tr><td>Boost</td><td>(B0) Boost-0</td><td>1x</td><td>No cap</td><td>false</td></tr><tr><td>Boost</td><td>(B1) Boost-1</td><td>3x</td><td>No cap</td><td>true</td></tr><tr><td>Boost</td><td>(B2) Boost-2</td><td>5x</td><td>No cap</td><td>true</td></tr><tr><td>Boost</td><td>(B3) Boost-3</td><td>7x</td><td>No cap</td><td>true</td></tr></tbody></table>


# Secrets

**Secrets** provides a centralised and secure way to store and manage your application's environment variables or what we call a **Secret. I**t can be used anywhere in your application without exposing the secrets to outer environments.

There are 3 types of Secrets which can be stored in cosmocloud -

## Database Secret <a href="#database-secret" id="database-secret"></a>

**Database Secret** is a confidential credential used to establish secure connections and access databases. It includes authentication information that allows Cosmocloud to authenticate itself to your database.

Database secrets typically include credentials such as -&#x20;

* Database name
* Mode
* Project Id
* Public key
* Private key
* Cluster name
* MongoDB URI

## Authentication Secret <a href="#authentication-secret" id="authentication-secret"></a>

**Authentication Secret** is a secret used to connect to your external Authentication Provider - be it an SSO provider or your own self hosted Authentication Layer.

## Custom secret <a href="#custom-secret" id="custom-secret"></a>

**Custom Secrets** are used to define your own custom Key-Value pairs which can be used to define and set custom environment variables.


# Custom Secrets

Cosmocloud lets you make custom secrets for any and every use case you might have wherein you want to store sensitive information, anything confidential in terms of key-value pairs.&#x20;

The process to make a custom secret is pretty simple – Refer to the screenshots below. You can then call your secret using the Secret Name ;)&#x20;

### **Select the Type of Secret as Custom**

<figure><img src="/files/0xLHCASjgcXjf6b4sYwx" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/81LwnpzJ1kIzgk4cEkBr" alt=""><figcaption></figcaption></figure>

### **Some common use cases for custom secrets include -**

* **Base URL to External Services** : This refers to the base URL used by an application to interact with external APIs. Even though a base URL might not be sensitive, but when combined with specific paths or parameters, it can become critical. Keeping this a secret can help prevent misuse or unauthorized access, especially when the base URL is part of a restricted or internal service that should not be widely known.
* **Values in .env Files** : Environment variables stored in .env files often include sensitive information such as API keys, configuration settings, and other secrets. These files are crucial for configuring an application’s environment without hard-coding sensitive information into the source code. Values in .env files can control anything from turning on debug modes to API endpoints and should be protected to ensure they are not exposed in source code repositories or through application leaks.
* **SSL/TLS Certificates** : Private keys for SSL/TLS certificates ensure secure, encrypted communications over the internet.
* **OAuth Tokens** : Used to access resources from third-party services, allowing applications to authenticate and authorize without exposing user passwords.
* **Cloud Provider Credentials** : Keys that enable programmatic management of cloud resources, essential for automating operations in cloud environments.
* **Encryption Keys** : Employed to encrypt and decrypt data, ensuring that sensitive information is accessible only to authorized parties.
* **Configuration Secrets** : Include API endpoints or feature flags that are sensitive; and used to tailor and control application behavior dynamically.
* **Service Account Credentials** : Credentials for automated processes that require specific permissions, often with more limited access than user accounts.
* **Payment Gateway API Keys** : Enable secure interactions with payment systems to process transactions without exposing sensitive financial details.
* **SSH Keys** : Used for secure shell access to servers, crucial for maintaining secure and controlled access to server resources.
* **API Rate Limit Keys** : Secrets that manage the rate at which applications can make requests to external APIs to comply with usage policies.
* **Third-Party App Integrations** : Tokens or keys that authenticate external applications or services to integrate with primary systems securely.


# Databases

Cosmocloud does not spin up dedicated databases on Free Tier projects right now. You can connect your own database by [<mark style="color:blue;">**following this guide**</mark>](/getting-started/3.-connect-your-database).

{% hint style="info" %}
&#x20;If you want dedicated databases on Pro Projects, reach out to [<mark style="color:blue;">**Cosmocloud Support**</mark>](mailto:support@cosmocloud.io).
{% endhint %}


# Releases

A release is a frozen application state, that allows you to package and ship a certain state of your application to a certain environment.

{% hint style="warning" %}
Releases are only available on Pro Projects and not on Free Tier.
{% endhint %}

## Creating a new Release

1. Navigate to **Application Layer -> Releases**.
2. Click on **Review & Deploy**.
3. Select the latest changes you would want to deploy and click **Next**.
4. Chose the environment you want to deploy on, pass the version tag (**such as v1.0.0**) and click **Deploy**.

Your release your be instantly live on the environment you have released on.

{% hint style="info" %}
For more information on Instant Deployments, [<mark style="color:blue;">**check here**</mark>](/advanced-guide/performance-considerations/instant-deployments).
{% endhint %}

## Promoting a release to another Environment

Often, you would want to bump your release X from one environment to another, for example from staging to production. To do this -

1. Click on the **3 dot menu button** of the release you want to bump.
2. Select **Promote release**.
3. Select the environment you want to promote the release to, and click **Promote**.


# Vector Search

## What is Vector Search?

Vector search is a search method which returns the result which are close to your search query in multi dimensional space.

## Difference between Full Text Search (FTS) and Vector Search

The basic difference between Full Text search and Vector Search is that it in FTS it returns only data based on the text-matches, whereas in Vector Search you get the result which are close to the vectors in multi-dimensional field.&#x20;

## Concepts

### Vector

A vector is a 1-D numerical array that represents data across multiple dimensions. Vectors can encapsulate various types of data, including text, images, audio, and unstructured data. Semantic similarity between vectors is assessed by calculating the distance between them.

### Vector Embedding

Vector Embedding also known as vectorization is the process of converting the data into vectors.

### Embedding Model

The LLM Models which convert normal data to Vector Embedding, for example OpenAI GPT model, AWS Bedrock, Google Gemini AI, etc.

## Useful links

* [Create a Vector Search Index on Cosmocloud](/resources/vector-search/create-a-vector-search-index)
* [Edit a Vector Search Index](/resources/vector-search/edit-a-vector-search-index)
* [Delete a Vector Search Index](/resources/vector-search/delete-a-vector-search-index)


# Create a Vector Search Index

* Head over to the vector search indexes option in the left menu&#x20;

<figure><img src="/files/rI51tkGGhyZ3FJSxgN9W" alt="" width="119"><figcaption></figcaption></figure>

* Now click on the Create Vector Search Index

<figure><img src="/files/Hz0xqCMUypPVc2yCrLy4" alt=""><figcaption></figcaption></figure>

* Select environment, db collection and vector search index name.

<figure><img src="/files/PtjlFyg2CSh9KGC39g1y" alt=""><figcaption></figcaption></figure>

* In the next step you need to define the mappings

<figure><img src="/files/9Sp9zXNsnEhuimRGhW73" alt=""><figcaption></figcaption></figure>

{% hint style="danger" %}
vector is a default field which is only there for the array of floats&#x20;
{% endhint %}

| Field                | Value                             | Example                                  |
| -------------------- | --------------------------------- | ---------------------------------------- |
| Type                 | vector \| field                   | vector                                   |
| Field Name           | fields in model                   | fields with type list of floats in model |
| Number Of Dimensions | number(1 - 4096)                  | 1023                                     |
| Similarity Function  | cosine \| euclidean \| dotProduct | cosine                                   |

{% hint style="danger" %}
Number Of Dimensions depends on the model which you have used to generate the vector embedings.
{% endhint %}

Once done with filling form then simply click on the create button on the bottom right of the form.


# Edit a Vector Search Index

To make changes in the existing Vector Search Index go to the vector search indexes page

<figure><img src="/files/ice0jr81j5NWLDxGQXKB" alt="" width="119"><figcaption></figcaption></figure>

* Select the Environment in which you want to change the Vector Search Index.

<figure><img src="/files/vmBgGASQhNdQVrJueWC6" alt=""><figcaption></figcaption></figure>

* Select the index in which you want to make changes from the list.

<figure><img src="/files/sY2yPuxuWUewtvJIv7Cq" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
You can make changes in the existing fields or add new fields.
{% endhint %}

* Click on the save button on the top right corner to save the changes.

<figure><img src="/files/HnAQGnn0iplwGxBT5UUS" alt=""><figcaption></figcaption></figure>


# Delete a Vector Search Index

To delete the vector search index, you can simply go to the Vector Search Index listing from the left menu and select the environment from which the index needs to be deleted.

And when you click on the 3 dots on the right of the list, you can delete the index.

<figure><img src="/files/zz8Oxv3NdzG5BLdN6TG2" alt=""><figcaption></figcaption></figure>


# Document Search

description!!


# Full Text Search

Full-text search is a specialised **search technique** that allows users to search for text within large amounts of textual data and **retrieve relevant documents** or records that contain the queried words or phrases.&#x20;

Full-text search enables users to find relevant information even if the search terms are not an exact match.

While traditional databases can handle some text-based searching using techniques like wildcard or pattern matching, they are not optimised for efficient full-text search across extensive text data.

## Understanding full-text search using a example

Imagine a library database with a collection of book records. Each record includes details such as the book's title, author, genre, and a brief description. Here's a simplified representation:

```javascript
{
  "books": [
    {
      "title": "The Catcher in the Rye",
      "author": "J.D. Salinger",
      "genre": "Fiction",
      "description": "A classic novel about teenage angst."
    },
    {
      "title": "To Kill a Mockingbird",
      "author": "Harper Lee",
      "genre": "Fiction",
      "description": "A poignant tale of racial injustice in the American South."
    },
    {
      "title": "The Great Gatsby",
      "author": "F. Scott Fitzgerald",
      "genre": "Fiction",
      "description": "A vivid portrayal of the American Dream in the 1920s."
    }
  ]
}

```

### **Performing Full-Text Search**

Now, let's say we want to find all books that discuss the theme of "American Dream." A traditional search might struggle with this task.

However, with full-text search capabilities we will receive result as :&#x20;

**Search Query:** "American Dream"

```javascript
{
  "results": [
    {
      "title": "The Great Gatsby",
      "author": "F. Scott Fitzgerald",
      "genre": "Fiction",
      "description": "A vivid portrayal of the American Dream in the 1920s."
    }
  ]
}

```

## Understand full-text search in detail

* [<mark style="color:blue;">**How does indexing work in full-text search ?**</mark>](/resources/document-search/full-text-search/concepts/indexing-in-full-text-search)
* [<mark style="color:blue;">**How data is processed using Analyzers ?**</mark> ](/resources/document-search/full-text-search/concepts/data-processing-using-analyzers)


# Concepts


# Indexing in full-text search

In the data/information retrieval systems, **indexing** is the technique of creating a records structure that allows for **quicker retrieval of statistics**.&#x20;

In the case of **full-text search**, indexing involves creating a **structured catalog** of words or terms found in the text data, along with their corresponding locations.

The indexing process in full-text search is determined by the analyzer used. An analyzer is a component responsible for tokenizing the text, applying various transformations, and generating indexed terms.

## For In-Depth Details

* [<mark style="color:blue;">**Refer to the Official Documentation of Indexes**</mark>](https://www.mongodb.com/docs/manual/indexes/)


# Data processing using Analyzers

An **analyzer** is a component **responsible for processing** and converting raw textual data into a format that is conducive to effective full-text search. It includes various sub-processes, such as **tokenization**, **stemming**, and removal of stop words.

## How is data processed ?

In Atlas Search, analyzers are like language experts that process and organize your data for effective searching. Think of them as tools with two main jobs:

1. **Tokenizer (Word Extractor):**
   * The tokenizer takes your text and extracts meaningful words, like breaking a sentence into individual words.
2. **Filters (Cleanup Crew):**
   * Filters are like a cleanup crew. They fix things like capitalization, punctuation, and unnecessary words, so your search results are spot-on.

By setting up an analyzer for a specific field, you decide how these language experts should do their job. They handle challenges like :&#x20;

* ignoring case (uppercase or lowercase)&#x20;
* removing unnecessary words
* understanding word variations etc.&#x20;

The result? Your data is processed in a way that makes searches super accurate and helpful. It's like having a language pro make your data search-friendly!

## For In-Depth Details

* [<mark style="color:blue;">**Refer to the Official Documentation of Analyzers**</mark>](https://www.mongodb.com/docs/atlas/atlas-search/analyzers/)


# Create a Search Index


# Creating a Custom Analyzer


# Full Text Search FAQ

<details>

<summary>I am getting an error "Your MongoDB org doesn't allow API access" when creating a Full Text Search index.</summary>

* Open your MongoDB Atlas account.
* Navigate to the **Settings** page for your **MongoDB Organization.**
  1. If it is not already displayed, select your desired organization from the  Organizations menu in the top navigation bar.
  2. Click the Organization Settings icon next to the Organizations menu.
* Toggle ***Require IP Access List for the Atlas Administration API*** to **Off**.

</details>


# Vector Search

coming soon !!


# Object Storage

Object storage is a cloud based distributed blob store used to store any amount of unstructured data such as images, videos, pdfs and any other file types. Cosmocloud Object storage is a fully managed, scalable storage layer, backed by Cloud’s Blob Storage like AWS S3, Azure Blob Storage, etc.

You create one or more Object Storage Buckets to store and maintain your data. Buckets are similar to folders / containers and can be used to store, retrieve, backup and access objects/files.

### How to create/edit Object Storage Buckets on Cosmocloud

Whenever a user initialises a project, an object storage / bucket is created for that project with the same name. You already get one bucket on the Development environment in the free tier. To create more, you need to[ *upgrade your project*](broken://pages/M1I3t8Qk7UmW2zIPGzuo)*.*

Once done, you can -

### Create a Bucket

* Navigate to the Object storage page using the side menu.
* Click on Create Bucket.
* Enter Bucket Name and Space (in GB) to create the bucket
* Click on Create.

### Edit a bucket

* To edit a bucket Navigate to the Object Storage page.
* Select the bucket to Edit.
* Enter the Space to update the storage
* Click save to update the storage.

### Delete a bucket.

* To delete a bucket Navigate to the Object Storage page.
* Click on the options on bucket to delete.
* Select delete.
* Confirm that you want to delete the bucket.

{% hint style="danger" %}
Note: Make sure that the bucket you are deleting is not being utilised anywhere or has any data before deleting as once deleted the data will not be able to restore.
{% endhint %}

### How to use Object Storage Buckets

To utilise Object Storage for uploading / downloading objects, Users need to create APIs either using our Starter template or Building from Scratch.

Here’s a quick starter on how to store, retrieve, delete files, once you have created the APIs using the above template.

* [Using Object storage API to store file](/examples-how-to/how-to-upload-download-media-in-object-storage#using-object-storage-api-to-store-file)  &#x20;
* [Retrieving files from Object storage](/examples-how-to/how-to-upload-download-media-in-object-storage#retrieving-files-from-object-storage)
* [Deleting files from Object storage](/examples-how-to/how-to-upload-download-media-in-object-storage#deleting-files-from-object-storage)

<br>


# Flow Builder

Cosmocloud's Flow Builder is one of the most interesting and exciting parts of using Cosmocloud. This is the **main engine** that powers custom logics in APIs, SubFlows and every other place where you need some logic based processing to be done.

<figure><img src="/files/zezQaYcbWadCMDIB8Xvk" alt=""><figcaption></figcaption></figure>

## Flow Types in Cosmocloud

### APIs

REST APIs are the essence of Backend Development, the most used way for your frontend (client) to talk to your backend layer. Every API has it's own flow which you can customise using the Flow Builder.

{% hint style="info" %}
Checkout more on building APIs [here](/resources/apis).
{% endhint %}

### SubFlows

SubFlow in Cosmocloud provides modular approach to build reusable piece of flow. It helps you to build a piece of code once and plug it in existing flow.

{% hint style="info" %}
Checkout more on SubFlows [here](/resources/subflows).
{% endhint %}

## Flow Builder Basic Concepts

### Nodes

Nodes are the individual boxes that represent one single functional component of your flow. Your flow would have multiple boxes linked together in a **flowchart** mode to define your APIs flow logic.

### Edges

An edge is the **connection path** between 2 nodes. This edge informs the flow of processing order of your APIs nodes.

Sometimes, you will also find more helpful actions on your Edges, to either add more nodes or more information about the edge / flow in that particular context.

## Adding new Nodes

There are 2 ways to add new Nodes in your Flow -

1. You can add new nodes into the flow by clicking the **Add Node** box at the end of every branch of the flowchart, excluding when your flow is finished with a `Response` node.
2. You can also add a node **between any 2 nodes** by clicked in **+** icon over the edge connecting the 2 nodes.

## Deleting any Node

You can click on the **X** delete icon on any node to delete that particular node from the flow.

{% hint style="warning" %}
There are some nodes which cannot be deleted, such as Trigger Nodes, Executor Node, Placeholder Nodes, etc.
{% endhint %}


# Node Types

## What is a node in Flow Builder?  <a href="#what-is-a-node-in-flow-engine" id="what-is-a-node-in-flow-engine"></a>

Nodes are the fundamental building blocks that power our Flow Builder. These nodes play a pivotal role in shaping the behaviour, logic, and outcomes of your workflows.

Cosmocloud's Flow Builder typically comprises of various types of Nodes in our system -

* [Trigger Nodes](/flow-builder/node-types/trigger-nodes)
* [Conditional Nodes](/flow-builder/node-types/conditional-nodes)
* [Crypto Nodes](/flow-builder/node-types/crypto-nodes)
* [Debug Node](/flow-builder/node-types/debug-node)
* [Database Nodes](/flow-builder/node-types/database-nodes)
* [External Nodes](/flow-builder/node-types/external-nodes)
* [Loop Nodes](/flow-builder/node-types/loop-nodes)
* [Variables Nodes](/flow-builder/node-types/variable-nodes)


# Trigger Nodes


# HTTP Response

The **HTTP Response** node is designed to send a response back to the client in an API flow. It's essential for completing the request-response cycle in web applications, allowing you to specify the status code and body content of the response. This ensures that the client receives the necessary information after processing a request.

| **Field**            | **Description**                              | **Required** | **Default** |
| -------------------- | -------------------------------------------- | ------------ | ----------- |
| Node name            | [Node name](/flow-builder/node-name)         | true         | -           |
| Response value       | Content to be sent back in the response body | false        | -           |
| Response status code | HTTP status code for the response            | true         | -           |

## Usage

1. Specify the response value. The previous value of node can be used here via [Magical Autocomplete](/flow-builder/cql-cosmocloud-query-language/magical-autocomplete).
2. Select the appropriate response status code from the dropdown menu.

## Returns

This node sends an HTTP response to the client.

## Example

Let's say you want to send list of users stored in the database.

1. You've used [List Records](/flow-builder/node-types/database-nodes/list-records) to fetch the users and now you can set the response value as `$.listRecords.result` .
2. Set the status code as `200 - OK`.

After the calling the API, you'll receive the list of users in the response body with status code as 200.

## Best Practices

1. Choose appropriate status code for different scenarios. For example, 200 for Successful Request, 201 for Resource Created Successfully, 400 for Invalid Request from Client. For more information, you can refer this [HTTP response status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status) document from MDN.

## Supported Status Code

|                 |                       |                                                       |
| --------------- | --------------------- | ----------------------------------------------------- |
| **Status Code** | **Meaning**           | **Use Case**                                          |
| 200             | OK                    | Successful request (GET, PUT, PATCH)                  |
| 201             | Created               | Successful resource creation (POST)                   |
| 202             | Accepted              | Request accepted, but processing not completed        |
| 204             | No Content            | Successful request with no content to return (DELETE) |
| 400             | Bad Request           | Invalid input, missing required fields                |
| 401             | Unauthorized          | Missing or invalid authentication token               |
| 403             | Forbidden             | User doesn't have necessary permissions               |
| 404             | Not Found             | Requested resource doesn't exist                      |
| 409             | Conflict              | Request conflicts with current state of the server    |
| 500             | Internal Server Error | Unexpected condition on the server                    |


# Conditional Nodes

Conditional nodes empower users to introduce **logic-driven** decision-making into their workflows. These nodes enable the creation of conditional branches, where the execution path is determined by the evaluation of specific conditions.

Some of the conditional nodes present in Cosmocloud are -

* [<mark style="color:blue;">If Else</mark>](/flow-builder/node-types/conditional-nodes/if-else)
* [<mark style="color:blue;">If Else V2</mark>](/flow-builder/node-types/conditional-nodes/if-else-v2)
* [Switch Case](/flow-builder/node-types/conditional-nodes/switch-case)

## Building Conditions

To build the conditions, you can open the Properties Panel by **Clicking on the Node** and selecting **Condition** property.

{% hint style="info" %}
[Checkout the condition builder here.](/flow-builder/cql-cosmocloud-query-language/building-conditions)
{% endhint %}


# If Else

**If Else** node lets you check for a boolean condition, which if true sends the flow execution to the **True** branch, else sends the flow execution to the **False** branch.

### Adding If Else node at the end

As you see in the below image, an **If Else** node comes with two child branches - **True** and **False** branch. You can build your remaining flow in these branches.

<figure><img src="/files/vsOwD3Gz8b3oMhjk9iai" alt="" width="375"><figcaption><p>An If Else condition Block</p></figcaption></figure>

### Adding If Else node between 2 nodes

If you try adding the **If Else** node between 2 existing nodes, you will see a popup asking you which branch should the existing children be part of.

<figure><img src="/files/mlwAgmUyY3xLl7KGSs6C" alt="" width="375"><figcaption></figcaption></figure>

This is because **If Else** node breaks the flow into 2 separate branches, **which never merge**. If you want the branches to merge, checkout [<mark style="color:blue;">**If Else V2**</mark>](broken://pages/N7zEthlMcnALe3I8oxup).

{% hint style="warning" %}

### Deleting If Else node

If you plan to delete the **If Else** node, keep in mind that it will **delete the whole flow** **below** the current If Else node as the system does not know which branch to connect to the parent node.\
This does not happen with [<mark style="color:blue;">**If Else V2**</mark>](/flow-builder/node-types/conditional-nodes/if-else-v2)<mark style="color:blue;">**.**</mark>
{% endhint %}

### Properties Panel

<table><thead><tr><th width="338">Field</th><th>Description</th><th>Required</th></tr></thead><tbody><tr><td>Node name</td><td><a href="/pages/jJ1qO0Ju8d7VFyPB2Jy3"><mark style="color:blue;"><strong>Checkout Node name</strong></mark></a></td><td>true</td></tr><tr><td>Condition</td><td>The condition object which this node evaluates at Flow Runtime, based on which the flow is sent to <strong>True</strong> branch or <strong>False</strong> branch.<br><br>Check <a href="/pages/aJtci0lt5gcR4VOrIDr9">this documentation</a> to see how to build conditions in this node.</td><td>true</td></tr></tbody></table>

### Returns

`condition` - The boolean result of the condition at runtime. You can access this using Magical Autocomplete (Eg. `$.<node_name>.condition`) in any node below this node.


# If Else V2

**If Else V2** node lets you check for a boolean condition, which if true executes to the **True** branch, else executes the **False** branch, **before coming back** to the normal flow.

### Adding If Else V2 node

As you see in the below image, an **If Else V2** node comes with two child branches - **True** and **False** branch. You can build your remaining flow in these branches.

<figure><img src="/files/IRXfZBI5eoEUsQQE6SWy" alt="" width="375"><figcaption></figcaption></figure>

As you see above, you will note that the **True** and **False** branches have **Executor nodes** attached to them. These executor nodes run a separate SubFlow **inside** the context of this flow (like a nested function) and once completed, it comes back to the normal flow **below** the executor nodes.

### Properties Panel

| Field     | Description                                                                                                                                                                                                                                                                                     | Required |
| --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
| Node name | [<mark style="color:blue;">**Checkout Node name**</mark>](/flow-builder/node-name)                                                                                                                                                                                                              | true     |
| Condition | <p>The condition object which this node evaluates at Flow Runtime, based on which the flow is sent to <strong>True</strong> branch or <strong>False</strong> branch.<br><br>Check <a href="/pages/aJtci0lt5gcR4VOrIDr9">this documentation </a>to see how to build conditions in this node.</p> | true     |

### Returns

N/A


# Switch Case

**Switch Case** node lets you check for a condition based on a **variable** which might be the result of some other conditions as well. Depending on the value of the **variable**, the Flow Execution will be sent to the branch matching that particular value.

### Adding Switch Case node at the end

As you see in the below image, a **Switch Case** node comes with two default child branches - **Default Case** and **Add Case** branch. You can keep adding cases in the switch as well as use the Default Branch for **Default** case.

<figure><img src="/files/jZbYJ6CajGFayAkGhQ5z" alt="" width="375"><figcaption></figcaption></figure>

### Adding Switch Case node between 2 nodes

If you try adding the **Switch Case** node between 2 existing nodes, you will see a popup asking you which branch should the existing children be part of.

<figure><img src="/files/DoVv8YnXSRzXtKdrGm8S" alt="" width="375"><figcaption></figcaption></figure>

This is because **Switch Case** node breaks the flow into 2 or more separate branches, **which never merge**.

{% hint style="warning" %}

### Deleting Switch Case node

If you plan to delete the **Switch Case** node, keep in mind that it will **delete the whole flow** **below** the current Switch Case node as the system does not know which branch to connect to the parent node.
{% endhint %}

### Properties Panel

<table><thead><tr><th>Field</th><th width="511">Description</th><th>Required</th></tr></thead><tbody><tr><td>Node name</td><td><a href="/pages/jJ1qO0Ju8d7VFyPB2Jy3"><mark style="color:blue;"><strong>Checkout Node name</strong></mark></a></td><td>true</td></tr><tr><td>Switch Value</td><td>The value which needs to be checked in the Switch condition.<br><br>This can also be a Magical Autocomplete.</td><td>true</td></tr><tr><td>Switch Value Type</td><td>The datatype of the Switch values to be typecasted into.</td><td>true</td></tr><tr><td>Cases</td><td>A list of cases to be checked, else default case.<br><br>Each case creates a new branch in the Flow Builder.</td><td>true</td></tr></tbody></table>

### Returns

`condition` - The boolean result of the condition at runtime. You can access this using Magical Autocomplete (Eg. `$.<node_name>.condition`) in any node below this node.


# Crypto Nodes


# PBKDF2 Hmac Hash

**PBKDF2 Hmac Hash** (Password-Based Key Derivation Function 2 using HMAC) is used to either securely hash a password or derive cryptographic keys from passwords

This might be useful if you want to store some passwords in the database for authentication purpose or generate a unique cryptographic key which can be used to encrypt and decrypt the data.

### Properties Panel

<table data-header-hidden><thead><tr><th></th><th width="286"></th><th></th><th></th></tr></thead><tbody><tr><td><strong>Field</strong></td><td><strong>Description</strong></td><td><strong>Required</strong></td><td><strong>Default</strong></td></tr><tr><td>Node name</td><td><a href="https://docs.cosmocloud.io/concepts-and-in-depth/flow-builder/node-name">Node Name</a></td><td>true</td><td>-</td></tr><tr><td>Hash Algorithm</td><td>Select any of the hash algorithm given: <code>sha256</code>, <code>sha1</code>, <code>sha224</code>, <code>sha512</code>, <code>md5</code></td><td>true</td><td>-</td></tr><tr><td>Hash Password</td><td>Password that needs to be hashed or generate a key that for encryption</td><td>true</td><td>-</td></tr><tr><td>Hash Salt</td><td>The salt value to use for the encryption</td><td>true</td><td>-</td></tr><tr><td>Hash Iterations</td><td>The number of iterations for the key derivation function</td><td>false</td><td>0</td></tr><tr><td>Hash DKLen</td><td>The desired length of the derived key</td><td>false</td><td>0</td></tr></tbody></table>

### Returns

`result` - The hexadecimal value of the key derived. You can access this using Magical Autocomplete (e.g. `$.<node_name>.result`) in any node below this node.


# Debug Node

The **Debug** node allows you to print values to the logs, enabling you to check and verify data during the execution of your API flow. This is particularly useful for troubleshooting and ensuring the accuracy of variables, such as dictionaries, by providing detailed logs for each API call.

## Properties Panel

### General

<table><thead><tr><th width="199">Field</th><th>Description</th><th>Required</th></tr></thead><tbody><tr><td>Node name</td><td><a href="/pages/jJ1qO0Ju8d7VFyPB2Jy3"><mark style="color:blue;"><strong>Checkout Node name</strong></mark></a></td><td>true</td></tr><tr><td>Response value</td><td>The value you want to send as the response</td><td>false</td></tr><tr><td>Response status code</td><td>The status code you want to send with the response</td><td>true</td></tr></tbody></table>

### Returns

This node doesn't return any value

\ <br>


# Database Nodes

Database nodes  in cosmocloud are used to perform database operations. These nodes makes it easy for user to retrieve, modify or update data.

{% hint style="info" %}
Before using these commands, ensure that you have an active database connection. If you haven't established a connection yet, please refer to the "[Connect your Database](/getting-started/3.-connect-your-database)" section in the documentation.
{% endhint %}

Some of the database nodes present in cosmocloud are -&#x20;

* [Delete One](/flow-builder/node-types/database-nodes/delete-one)
* [Delete Many](/flow-builder/node-types/database-nodes/delete-many)
* [Fetch by ID](/flow-builder/node-types/database-nodes/fetch-by-id)
* [Fine One](/flow-builder/node-types/database-nodes/find-one)
* [Find Many](/flow-builder/node-types/database-nodes/find-many)
* [Insert One](/flow-builder/node-types/database-nodes/insert-one)
* [Insert Many](/flow-builder/node-types/database-nodes/insert-many)
* [List Records](/flow-builder/node-types/database-nodes/list-records)
* [Run Aggregation Pipeline](/flow-builder/node-types/database-nodes/run-aggregation-pipeline)
* [Update One](/flow-builder/node-types/database-nodes/update-one)
* [Update Many](/flow-builder/node-types/database-nodes/update-many)

{% hint style="info" %}
Have a look into [CQL - Cosmocloud Query Language](/flow-builder/cql-cosmocloud-query-language) when working Complex Database Queries.
{% endhint %}


# Delete One

Think of a **Delete One** node  lets you easily remove certain pieces of information from a database. It's like having a delete button for specific data entry, helping you tidy up your database by getting rid of what you no longer need.

### Properties Panel

<table><thead><tr><th width="153">Field</th><th width="477">Description</th><th>Required</th></tr></thead><tbody><tr><td>Node name</td><td><a href="/pages/jJ1qO0Ju8d7VFyPB2Jy3"><mark style="color:blue;"><strong>Checkout Node name</strong></mark></a></td><td>true</td></tr><tr><td>Database collection</td><td>Database collection in which you want to query</td><td>true</td></tr><tr><td>Record Id</td><td>Unique id of record that needs to be deleted</td><td>true</td></tr></tbody></table>

### Returns

Delete node does not return any value.


# Delete Many

A **delete many** node allows users to remove several pieces of data at once. It's like a tool that helps you clean up your database efficiently by deleting multiple entries in one go, saving you time and effort.

### Properties Panel

<table><thead><tr><th width="153">Field</th><th width="477">Description</th><th>Required</th></tr></thead><tbody><tr><td>Node name</td><td><a href="/pages/jJ1qO0Ju8d7VFyPB2Jy3"><mark style="color:blue;"><strong>Checkout Node name</strong></mark></a></td><td>true</td></tr><tr><td>Database collection</td><td>Database collection in which you want to query</td><td>true</td></tr><tr><td>Delete Query Snippet</td><td>Query to look for documents to delete</td><td>true</td></tr></tbody></table>

### Returns

Delete multiple records node does not return any value.


# Fetch By ID

**Fetch By ID**  node helps in  data retrieved from a database in response to a query or request.&#x20;

It's like pulling out specific information from a filing cabinet or a digital storage system. When you fetch records, you're essentially getting the data you asked for from the database.

### Properties Panel

<table><thead><tr><th width="153">Field</th><th width="374">Description</th><th>Required</th><th>Default</th></tr></thead><tbody><tr><td>Node name</td><td><a href="/pages/jJ1qO0Ju8d7VFyPB2Jy3"><mark style="color:blue;"><strong>Checkout Node name</strong></mark></a></td><td>true</td><td>_</td></tr><tr><td>Database collection</td><td>Database collection in which you want to query</td><td>true</td><td>_</td></tr><tr><td>Record Id</td><td>Unique id of record that needs to be fetched</td><td>true</td><td>_</td></tr><tr><td>Record Id type</td><td>Type of record id which is to be fetched</td><td>false</td><td>ObjectId</td></tr></tbody></table>

### Returns

`result` - The result of the query at runtime.  You can access this using Magical Autocomplete (e.g. `$.<node_name>.result`) in any node below this node.


# Find One

**Find One** node is designed to retrieve a single specific record from a database based on a given query. It's analogous to finding a particular piece of information that matches specified conditions.

This node is particularly useful when you need to fetch a unique record or when you're certain that only one record matches your criteria. If multiple records match the query, only the first matching record will be returned.

### Properties Panel

<table data-header-hidden><thead><tr><th width="156"></th><th width="351"></th><th></th></tr></thead><tbody><tr><td><strong>Field</strong></td><td><strong>Description</strong></td><td><strong>Required</strong></td></tr><tr><td>Node name</td><td><a href="/pages/jJ1qO0Ju8d7VFyPB2Jy3">Node Name</a></td><td>true</td></tr><tr><td>Database collection</td><td>Database collection in which you want to find that specific information</td><td>true</td></tr><tr><td>Query</td><td>Query to identify which documents needs to be modified</td><td>false</td></tr><tr><td>Projection</td><td>Specifies which fields to include or exclude in the result</td><td>false</td></tr></tbody></table>

### Usage

1. Select the database collection you want to search.
2. Define your query to match the desired record. For example: `{ "user_id": { "$eq" : "12345" } }`
3. (Optional) Specify a projection to include only relevant fields. For example: `{ "name": 1, "email": 1, "_id": 0 }`

### Returns

`result` - The matching document from the database. If no document matches the query, this will be `null`. You can access this using Magical Autocomplete (e.g. `$.<node_name>.result`) in any node below this node.

### Example

Let's say you want to find a user by their email address and retrieve only their name and age:

1. Set Database Collection to `users`
2. Set Query to `{ "email": {"$eq": "user@example.com" } }`
3. Set Projection to `{ "name": 1, "age": 1, "_id": 0 }`

This will return a result like:

```
{
  "name": "John Doe",
  "age": 30
}
```

### Best Practices

* Ensure your query is specific enough to return only one document, or be prepared to handle cases where the first matching document may not be the one you want.
* Use indexing on frequently queried fields to improve performance.
* Be cautious with projections to avoid exposing sensitive data.


# Find Many

**Find Many** node is designed to retrieve multiple records from a database based on a given query. It's useful when you need to fetch a set of documents that match specific criteria.

This node is particularly valuable when you want to retrieve multiple records that share certain characteristics or when you need to perform operations on a subset of your data.

### Properties Panel

| **Field**           | **Description**                                                        | **Required** |
| ------------------- | ---------------------------------------------------------------------- | ------------ |
| Node name           | [Node Name](/flow-builder/node-name)                                   | true         |
| Database collection | Database collection from which you want to retrieve multiple documents | true         |
| Query               | Query to identify which documents need to be retrieved                 | false        |
| Projection          | Specifies which fields to include or exclude in the result             | false        |

### Usage

1. Select the database collection you want to search.
2. Define your query to match the desired records. For example: `{ "status": { "$eq": "active" } }`
3. (Optional) Specify a projection to include only relevant fields. For example: `{ "name": 1, "email": 1, "_id": 0 }`

### Returns

`result` - An array of documents from the database that match the query. If no documents match the query, this will be an empty array.. You can access this using Magical Autocomplete (e.g. `$.<node_name>.result`) in any node below this node.

### Example

Let's say you want to find all users who are over 18 years old, retrieve only their names and ages:

1. Set Database Collection to `users`
2. Set Query to `{ "age": { "$gt": 18 } }`
3. Set Projection to `{ "name": 1, "age": 1, "_id": 0 }`

This will return a result like:

```json
[
  {
    "name": "Alice Johnson",
    "age": 35
  },
  {
    "name": "Bob Smith",
    "age": 28
  },
  {
    "name": "Charlie Brown",
    "age": 22
  },
  ...
]
```

### Best Practices

* Use indexing on frequently queried fields to improve performance.
* Be cautious with projections to avoid exposing sensitive data.
* When possible, use specific queries to reduce the number of documents that need to be scanned.


# Insert One

**Insert One node** add new data or information into a database. It's like placing a new entry into a filing cabinet or adding a new item to a list.&#x20;

When you insert a record, you're essentially inputting fresh data into the database for storage and future retrieval.

### Properties Panel

<table><thead><tr><th width="153">Field</th><th width="477">Description</th><th>Required</th></tr></thead><tbody><tr><td>Node name</td><td><a href="/pages/jJ1qO0Ju8d7VFyPB2Jy3"><mark style="color:blue;"><strong>Checkout Node name</strong></mark></a></td><td>true</td></tr><tr><td>Database collection</td><td>Database collection in which you want to query</td><td>true</td></tr><tr><td>Record to insert</td><td>Record that need to inserted. You can use magical autocomplete for this field</td><td>true</td></tr></tbody></table>

### Returns

`result` - The result of the query at runtime.  You can access this using Magical Autocomplete (e.g. `$.<node_name>.result`) in any node below this node.


# Insert Many

**Insert Many** node adds more than one set of data into a database at once. It's like filling multiple slots in a filing cabinet with new information or adding multiple items to a shopping cart.&#x20;

Instead of inserting one record at a time, this feature allows users to input several data entries simultaneously, which can be more efficient when dealing with large amounts of information.

### Properties Panel

<table><thead><tr><th width="153">Field</th><th width="477">Description</th><th>Required</th></tr></thead><tbody><tr><td>Node name</td><td><a href="/pages/jJ1qO0Ju8d7VFyPB2Jy3"><mark style="color:blue;"><strong>Checkout Node name</strong></mark></a></td><td>true</td></tr><tr><td>Database collection</td><td>Database collection in which you want to query</td><td>true</td></tr><tr><td>Records to insert</td><td>Records that need to inserted. It expects array of records. You can use magical autocomplete for this field</td><td>true</td></tr></tbody></table>

### Returns

`result` - The result of the query at runtime.  You can access this using Magical Autocomplete (e.g. `$.<node_name>.result`) in any node below this node.


# List Records

**List records** node helps in displaying or retrieving data from a database, typically in the form of a list. It's like pulling out a list of items from a file cabinet .&#x20;

When you list records, you're essentially fetching and presenting the data stored in the database for review or analysis.

### Properties Panel

<table><thead><tr><th width="153">Field</th><th width="477">Description</th><th>Required</th></tr></thead><tbody><tr><td>Node name</td><td><a href="/pages/jJ1qO0Ju8d7VFyPB2Jy3"><mark style="color:blue;"><strong>Checkout Node name</strong></mark></a></td><td>true</td></tr><tr><td>Database collection</td><td>Database collection in which you want to list</td><td>true</td></tr><tr><td>Limit</td><td>Specifies the maximum number of records to be returned by a query</td><td>false</td></tr><tr><td>Offset</td><td>Specifies the starting point from which to retrieve records. It determines how many records to skip before beginning to return data.</td><td>false</td></tr></tbody></table>

### Returns

`result` - The result of the query at runtime.  You can access this using Magical Autocomplete (e.g. `$.<node_name>.result`) in any node below this node.


# Run Aggregation Pipeline

**Run Aggregation Pipeline** are specific data you get from a database when you ask for exactly what you need using a customised search. It's like getting just the right information from a big pile of data by asking the database specific questions.

### Properties Panel

<table><thead><tr><th width="153">Field</th><th width="477">Description</th><th>Required</th></tr></thead><tbody><tr><td>Node name</td><td><a href="/pages/jJ1qO0Ju8d7VFyPB2Jy3"><mark style="color:blue;"><strong>Checkout Node name</strong></mark></a></td><td>true</td></tr><tr><td>Database collection</td><td>Database collection in which you want to query</td><td>true</td></tr><tr><td>Custom Aggregate Query</td><td>Custom aggregation query that you want to execute on collection above</td><td>true</td></tr></tbody></table>

### Returns

`result` - The result of the aggregation query at runtime. You can access this using Magical Autocomplete (e.g. `$.<node_name>.result`) in any node below this node.


# Update One

**Update One** node is designed to modify a single specific record in a database based on a given query. It's useful when you need to update the information of a particular document that matches specified conditions.

This node is particularly valuable when you want to modify a unique record or when you're certain that only one record should be updated based on your criteria. If multiple records match the query, only the **first** matching record will be updated.

### Properties Panel

| **Field**           | **Description**                                                       | **Required** | **Default** |
| ------------------- | --------------------------------------------------------------------- | ------------ | ----------- |
| Node name           | [Node Name](/flow-builder/node-name)                                  | true         | -           |
| Database collection | Database collection in which you want to update a specific document   | true         | -           |
| Query Snippet       | Query to identify which document needs to be modified                 | false        | -           |
| Update Snippet      | Object which which will be used to replace or update current document | true         | -           |
| Upsert              | Insert if document does not exist                                     | false        | false       |

### Usage

1. Select the database collection you want to update.
2. Define your query to match the desired record. For example: `{ "user_id": { "$eq": "12345" } }`
3. Specify the update snippet to apply the desired modifications. For example: `{ "$set": { "status": "active" } }`
4. Set the upsert option to true or false based on whether you want to create a new document if no match is found.

### Returns

This node does not returns any value.

### Example

Let's say you want to update a user's status to `active` based on their email address, and create the user if they don't exist:

1. Set Database Collection to `users`
2. Set Query to `{ "email": { "$eq": "user@example.com" } }`
3. Set Update snippet to `{ "$set": { "status": "active", "last_login": "2024-07-22T10:00:00Z" } }`
4. Set Upsert to true

This will either update an existing user's status and last login time, or create a new user with these details if no matching user is found.

### Best Practices

* Ensure your query is specific enough to target only the intended document.
* Use atomic update operators (like $set, $inc, $push) to perform efficient updates without retrieving the entire document.
* Be cautious when using `upsert=true`, as it can create new documents. Make sure your update snippet includes all necessary fields for a new document.


# Update by ID

**Update by ID** node helps in modifying existing data entry in a database. It's like editing information in a document or changing details in a form.&#x20;

When you update record, you're essentially making alterations to the data stored in the database, ensuring that it reflects the most current and accurate information.

### Properties Panel

<table><thead><tr><th width="153">Field</th><th width="394">Description</th><th>Required</th><th>Default</th></tr></thead><tbody><tr><td>Node name</td><td><a href="/pages/jJ1qO0Ju8d7VFyPB2Jy3"><mark style="color:blue;"><strong>Checkout Node name</strong></mark></a></td><td>true</td><td>_</td></tr><tr><td>Database collection</td><td>Database collection in which you want to list</td><td>true</td><td>_</td></tr><tr><td>Record Id</td><td>Unique id of document that you want to modify</td><td>true</td><td>_</td></tr><tr><td>Record Id Type</td><td>Type of record id which is to be fetched</td><td>false</td><td>ObjectId</td></tr><tr><td>Update query</td><td>Object which which will be used to replace or update current document</td><td>true</td><td>_</td></tr><tr><td>Upsert</td><td>Insert if document does not exist</td><td>false</td><td>false</td></tr></tbody></table>

### Returns

This node does not returns any value.


# Update Many

**Update Many** node helps in modifying more than one existing data entry in a database simultaneously. It's like making changes to multiple items on a list or editing several sentences in a document at once.&#x20;

When you update multiple records, you're essentially applying the same modification to several data entries in the database, streamlining the process of managing and maintaining large datasets.

### Properties Panel

<table><thead><tr><th width="153">Field</th><th width="477">Description</th><th>Required</th></tr></thead><tbody><tr><td>Node name</td><td><a href="/pages/jJ1qO0Ju8d7VFyPB2Jy3"><mark style="color:blue;"><strong>Checkout Node name</strong></mark></a></td><td>true</td></tr><tr><td>Database collection</td><td>Database collection in which you want to list</td><td>true</td></tr><tr><td>Query snippet</td><td>Query to identify which documents needs to be modified</td><td>true</td></tr><tr><td>Update snippet</td><td>Update object which will be used to replace current documents data</td><td>true</td></tr></tbody></table>

### Returns

This node does not returns any value.


# External Nodes

External nodes play a pivotal role in extending the functionality of workflows by providing direct integration with external services, APIs, and resources. These nodes empower users to seamlessly interact with external systems, thereby enhancing the scope and versatility of their applications.

Some of the external nodes present in cosmocloud are -

* **API Call :** This node allows you to easily connect with external APIs within your API flow, enabling smooth interactions and expanding the functionality of your workflow.
* **Get Presigned URL** : This node allows user to generate a unique URL that provides temporary access to a specific resource hosted on a cosmocloud storage service.
* **Post Presigned URL** : This node allows user to generate a presigned URL that is specifically generated for the purpose of allowing HTTP POST requests.
* **Send EMAIL (SES) :** This node allows user to send emails to specified user using AWS SES Service.
* **Send SMS (SNS):** This nodes allows user to send text messages or notifications to user using AWS SNS service.
* **Fire Events (SQS) :** This node allows user to fire event to a external queue using AWS SQS service.


# Fire Events (SQS)

This nodes enables user to send/ fire events to an **external queue.** This node helps in triggering actions or events based on messages.

### Properties Panel

#### Connect to AWS

<table data-full-width="false"><thead><tr><th width="237">Field</th><th width="334">Description</th><th width="222">Required</th><th data-hidden>Default</th></tr></thead><tbody><tr><td>Queue name</td><td>Name of your queue</td><td>true</td><td>_</td></tr><tr><td>AWS access key</td><td>Your AWS access key</td><td>true</td><td>_</td></tr><tr><td>AWS access secret</td><td>Your AWS access secret</td><td>true</td><td>_</td></tr><tr><td>Region</td><td>Region where your queue is deployed</td><td>true</td><td>_</td></tr></tbody></table>

#### Content

<table data-full-width="false"><thead><tr><th width="237">Field</th><th width="334">Description</th><th width="222">Required</th><th data-hidden>Default</th></tr></thead><tbody><tr><td>Payload</td><td>Payload to be sent  (string format)</td><td>true</td><td>_</td></tr></tbody></table>

### Returns

This node does not returns any value.


# API Call

**API call** node is used to retrieve data from external sources, manipulate data, integrate different software systems, automate tasks, and customise applications by accessing and interacting with external services or resources .&#x20;

### Properties Panel

#### General&#x20;

<table data-full-width="true"><thead><tr><th width="370">Field</th><th width="379">Description</th><th width="114">Required</th><th>Depends on</th></tr></thead><tbody><tr><td>Node name</td><td><a href="/pages/jJ1qO0Ju8d7VFyPB2Jy3"><mark style="color:blue;"><strong>Checkout Node name</strong></mark></a></td><td>true</td><td>_</td></tr><tr><td>URL</td><td>A web address that specifies the location of a resource on the internet.</td><td>true</td><td>_</td></tr><tr><td>Method</td><td>API call method for the specified url</td><td>true</td><td>_</td></tr><tr><td>JSON Payload</td><td>Payload data for the API call</td><td>false</td><td>Method is 'POST'</td></tr><tr><td>Request headers</td><td>Headers for the API call if needed</td><td>false</td><td>-</td></tr></tbody></table>

#### Authentication

<table data-full-width="true"><thead><tr><th width="195">Field</th><th width="246">Description</th><th>Required</th><th>Default</th><th>Depends on</th></tr></thead><tbody><tr><td>Type</td><td>Authentication type (if API is authenticated)</td><td>false</td><td>No Auth</td><td>_</td></tr><tr><td>Username</td><td>Username for basic/digest auth</td><td>true</td><td>_</td><td>Basic Auth / Digest Auth</td></tr><tr><td>Password</td><td>Password for basic/digest auth</td><td>true</td><td>_</td><td>Basic Auth / Digest Auth</td></tr><tr><td>Header prefix</td><td>prefix used in the Authorization header of API request</td><td>false</td><td>Bearer</td><td>Bearer Token</td></tr><tr><td>Token</td><td>Token for API call</td><td>true</td><td>_</td><td>Bearer Token</td></tr><tr><td>Key</td><td>unique identifier provided to access an API</td><td>true</td><td>_</td><td>API Key</td></tr><tr><td>Value</td><td>corresponding secret or token associated with provided key</td><td>true</td><td>_</td><td>API Key</td></tr><tr><td>Add to</td><td>Headers or Params</td><td>true</td><td>_</td><td>API Key</td></tr></tbody></table>

### Returns

* `body` - The result of the API call at runtime. You can access this using Magical Autocomplete (eg. `$.<node_name>.body`) in any node below this node.
* `statusCode` - Status of API call at runtime to check any possible errors. You can access this using Magical Autocomplete (eg. `$.<node_name>.statusCode`) in any node below this node.


# Delete storage objects

The **Delete Storage Objects** node allows you to delete objects that are stored in object storage, typically hosted on cosmocloud storage accounts.

## Properties Panel

### General

<table data-full-width="false"><thead><tr><th width="199">Field</th><th width="379">Description</th><th width="114">Required</th></tr></thead><tbody><tr><td>Node name</td><td><a href="/pages/jJ1qO0Ju8d7VFyPB2Jy3"><mark style="color:blue;"><strong>Checkout Node name</strong></mark></a></td><td>true</td></tr><tr><td>Storage account name</td><td>Name of the Storage bucket where your objects/files exists</td><td>true</td></tr><tr><td>Objects to delete</td><td>List of the resources you would like to delete</td><td>true</td></tr></tbody></table>

### Returns

`result` - true if the objects get deleted. You can access this using Magical Autocomplete (eg. `$.<node_name>.result`) in any node below this node.

<br>


# Execute SubFlow

**Execute SubFlow** node is used to execute a predefined subflow.  It helps us to integrate a resuable block of flow in existing flow.

### Properties Panel

#### General&#x20;

<table data-full-width="false"><thead><tr><th width="199">Field</th><th width="379">Description</th><th width="114">Required</th></tr></thead><tbody><tr><td>Node name</td><td><a href="/pages/jJ1qO0Ju8d7VFyPB2Jy3"><mark style="color:blue;"><strong>Checkout Node name</strong></mark></a></td><td>true</td></tr><tr><td>Subflow to execute</td><td>Select the subflow that you wish to execute</td><td>true</td></tr><tr><td>Arguments</td><td>Enter all the arguments that are required by subflow</td><td>true</td></tr></tbody></table>

#### Returns

* `result` - Return value of subflow in runtime. You can access this using Magical Autocomplete (eg. `$.<node_name>.result`) in any node below this node.


# Get Presigned URL

**Get Presigned URL** node helps us to generate a presigned URL that provides temporary access to a specific resource, typically hosted on cosmocloud **object storage buckets**.&#x20;

This URL is generated with a limited set of permissions and an expiration time, allowing users or applications to securely access the resource without requiring permanent access credentials.

### Properties Panel

<table data-full-width="false"><thead><tr><th width="169">Field</th><th width="307">Description</th><th width="122">Required</th><th>Default</th></tr></thead><tbody><tr><td>Node name</td><td><a href="/pages/jJ1qO0Ju8d7VFyPB2Jy3"><mark style="color:blue;"><strong>Checkout Node name</strong></mark></a></td><td>true</td><td>_</td></tr><tr><td>File name</td><td>Name of file that you need to access</td><td>true</td><td>_</td></tr><tr><td>Object Storage Bucket Name</td><td>Object Storage bucket is where resource is located</td><td>true</td><td>_</td></tr><tr><td>Expires in </td><td>Expiration time for presigned URL (in seconds)</td><td>false</td><td>300 seconds</td></tr></tbody></table>

### Returns

`result` - Generated presigned url at runtime. You can access this using Magical Autocomplete (eg. `$.<node_name>.result`) in any node below this node.


# Post Presigned URL

**Post presigned URL** node is used to generate presigned URL that is specifically generated for the purpose of allowing HTTP POST requests. It is used for securely uploading files or data to a server or a cloud storage service

### Properties Panel

<table data-full-width="false"><thead><tr><th width="177">Field</th><th width="307">Description</th><th width="122">Required</th><th>Default</th></tr></thead><tbody><tr><td>Node name</td><td><a href="/pages/jJ1qO0Ju8d7VFyPB2Jy3"><mark style="color:blue;"><strong>Checkout Node name</strong></mark></a></td><td>true</td><td>_</td></tr><tr><td>File name</td><td>Name of file that you need to upload</td><td>true</td><td>_</td></tr><tr><td>Object Storage Bucket name</td><td>Object Storage Bucket is where resource is located</td><td>true</td><td>_</td></tr><tr><td>URL Expires in</td><td>Expiration time for presigned URL (in seconds)</td><td>false</td><td>300 seconds</td></tr><tr><td>File size</td><td>Size of file/ resource you want to upload (in bytes)</td><td>true</td><td>_</td></tr></tbody></table>

### Returns

`result` - Generated presigned url at runtime. You can access this using Magical Autocomplete (eg. `$.<node_name>.result`) in any node below this node.


# Send EMAIL (SES)

The **Send Email (SES)** node is  used to utilise AWS SES (Simple Email Service) to send emails.

### Properties Panel

#### Connect to AWS

<table data-full-width="false"><thead><tr><th width="237">Field</th><th width="334">Description</th><th width="222">Required</th><th data-hidden>Default</th></tr></thead><tbody><tr><td>AWS access key</td><td>Your AWS access key</td><td>true</td><td>_</td></tr><tr><td>AWS access secret</td><td>Your AWS access secret</td><td>true</td><td>_</td></tr><tr><td>Region</td><td>Region where your queue is deployed</td><td>true</td><td>_</td></tr></tbody></table>

#### Parameters

<table data-full-width="false"><thead><tr><th width="196">Field</th><th width="375">Description</th><th width="222">Required</th><th data-hidden>Default</th></tr></thead><tbody><tr><td>From</td><td>Enter origin email address</td><td>true</td><td>_</td></tr><tr><td>To Addresses</td><td>Enter destination email addresses (expects a list)</td><td>true</td><td>_</td></tr><tr><td>Cc Addresses</td><td>Enter cc email addresses (expects a list)</td><td>true</td><td>_</td></tr><tr><td>Bcc Addresses</td><td>Enter bcc email addresses (expects a list)</td><td>false</td><td></td></tr></tbody></table>

#### Content

<table data-full-width="false"><thead><tr><th width="196">Field</th><th width="375">Description</th><th width="222">Required</th><th data-hidden>Default</th></tr></thead><tbody><tr><td>Subject</td><td>Enter email subject</td><td>true</td><td>_</td></tr><tr><td>Body</td><td>Enter email body</td><td>true</td><td>_</td></tr></tbody></table>

### Returns

This node does not returns any value.


# Send SMS (SNS)

The **Send SMS (SNS)** node is  used to utilise AWS SNS(Simple Notification Service) to send text messages/notifications.

### Properties Panel

#### Connect to AWS

<table data-full-width="false"><thead><tr><th>Field</th><th>Description</th><th>Required</th><th data-hidden>Default</th></tr></thead><tbody><tr><td>AWS access key</td><td>Your AWS access key</td><td>true</td><td>_</td></tr><tr><td>AWS access secret</td><td>Your AWS access secret</td><td>true</td><td>_</td></tr><tr><td>Region</td><td>Region where your queue is deployed</td><td>true</td><td>_</td></tr></tbody></table>

#### Parameters

<table data-full-width="false"><thead><tr><th width="112">Field</th><th width="185">Description</th><th width="107">Required</th><th>Format</th><th data-hidden>Default</th></tr></thead><tbody><tr><td>Phone number</td><td>Enter destination phone number</td><td>true</td><td>E.146 [+910123456789]</td><td>_</td></tr></tbody></table>

#### Content

<table data-full-width="false"><thead><tr><th>Field</th><th>Description</th><th>Required</th><th data-hidden>Default</th></tr></thead><tbody><tr><td>Message</td><td>Enter message content</td><td>true</td><td>_</td></tr></tbody></table>

### Returns

This node does not returns any value.


# Loop Nodes

Loop nodes are integral elements that facilitate the automation of repetitive tasks within workflows. These nodes empower users to iterate over a set of data, perform a series of actions multiple times, and dynamically process each iteration.

Some of the loop nodes present in cosmocloud are -

* **For Loop :** This node empowers you to iterate over a set of values or elements within your API flow, enabling you to perform repetitive actions, apply logic, and process data sequentially as part of your workflow.&#x20;
* **While Loop :** This node empowers you to create a loop within your API flow that continues executing as long as a specified condition is met.


# For loop

**For Loop** node iterates over a list or a collection, executing a set of instructions for each item. It allows for repetitive processing within an API flow, enabling actions to be performed on multiple elements efficiently.

## Properties Panel

### General

<table><thead><tr><th width="199">Field</th><th>Description</th><th>Required</th></tr></thead><tbody><tr><td>Node name</td><td><a href="/pages/jJ1qO0Ju8d7VFyPB2Jy3"><mark style="color:blue;"><strong>Checkout Node name</strong></mark></a></td><td>true</td></tr><tr><td>Variable to use</td><td>Variable you wish to use as a iterator e.g. <code>`$.variables.index`</code></td><td>true</td></tr><tr><td>Condition</td><td>Condition when you would like to exit the loop. Check <a href="/pages/aJtci0lt5gcR4VOrIDr9">this documentation</a> to see how to build conditions in this node.</td><td>true</td></tr><tr><td>Increment factor</td><td>The factor by each you want to increment the variable after each iteration. e.g. 1</td><td>true</td></tr></tbody></table>

### Returns

This node does not return any value


# While loop

**While Loop** node iterates over a list or a collection, executing a set of instructions for each item until an exit condition is met.

## Properties panel

### General

<table><thead><tr><th width="199">Field</th><th>Description</th><th>Required</th></tr></thead><tbody><tr><td>Node name</td><td><a href="/pages/jJ1qO0Ju8d7VFyPB2Jy3"><mark style="color:blue;"><strong>Checkout Node name</strong></mark></a></td><td>true</td></tr><tr><td>Condition</td><td>Condition when you would like to exit the loop. Check <a href="/pages/aJtci0lt5gcR4VOrIDr9">this documentation</a> to see how to build conditions in this node.</td><td>true</td></tr></tbody></table>

### Returns

This node does not return any value


# Variable Nodes

Variable nodes are essential components that empower users to work with dynamic data within workflows. These nodes enable the creation and management of variables, which are placeholders for storing and retrieving information.

Some type of variable nodes present in cosmocloud are -

## Arrays&#x20;

* **Append to Array :** This node facilitates the addition of new elements to an existing array within your API flow.
* **Contains :** This node serves to determine whether a specific value is present within a given array.
* **Check array empty :** This node allows you to check if a given array holds some values.
* **Length of Array :** This node enables you to determine the number of elements within an array within your API flow.
* **Reverse Array :** This node empowers you to reverse the order of elements within an array within your API flow.
* **Sort Array :** This node is used to sort array (ascending or descending) within your API flow.

## Strings <a href="#strings" id="strings"></a>

* **Append to String :** This node empowers you to dynamically extend a string within your API flow, enabling flexible content building and dynamic string concatenation.
* **Concat String :** This node enables you to effortlessly combine multiple strings within your API flow, facilitating dynamic text creation and versatile content generation.
* **Set Variable :** This node allows you to define and assign values to variables within your API flow. This node is essential for storing and managing data that can be used throughout the workflow.
* **Slice String :** The "Slice String" node empowers you to extract a portion of a string within your API flow.
* **To Lower :** This node allows you to convert a string to lowercase within your API flow.&#x20;
* **To Upper :** This node enables you to convert a string to uppercase within your API flow.
* **Trim String:** This node empowers you to remove leading and trailing whitespace from a string within your API flow.

## Mathematical

* **Add Variable :** This node optimises API flows by enabling summation operations, enhancing computational capabilities, and improving workflow efficiency through calculated variables.
* **Complex Maths Expr :** This node empowers you to perform intricate mathematical calculations seamlessly within your API flow, enabling advanced computations and data transformations.
* **Decrement Variable :** This node allows you to decrease the value of a variable within your API flow.&#x20;
* **Divide Variable :** This node enables you to perform division operations on a variable within your API flow.
* **Increment Variable :** This node enables you to increase the value of a variable within your API flow.
* **Multiply Variable :** This node enables you to perform multiplication operations on a variable within your API flow.
* **Subtract Variable :** This node enables you to conduct subtraction operations on a variable within your API flow.

## JSON <a href="#json" id="json"></a>

* **Merge JSON :** This node allows you to combine and unify multiple JSON objects within your API flow.&#x20;
* **Build JSON Object :** This node allows you to construct and customise JSON data structures effortlessly within your API flow, enhancing data formatting.

<br>


# Arrays


# Append array

The **Append array** node is  used to append values to end of an array

### Properties Panel

#### General

<table data-full-width="false"><thead><tr><th width="244">Field</th><th>Description</th><th>Required</th><th data-hidden>Default</th></tr></thead><tbody><tr><td>Node name</td><td><a href="/pages/jJ1qO0Ju8d7VFyPB2Jy3"><mark style="color:blue;"><strong>Checkout Node name</strong></mark></a></td><td>true</td><td>_</td></tr><tr><td>Variable name</td><td>Name of array where you need to append values</td><td>true</td><td>_</td></tr><tr><td>Arrays to append</td><td>Values to be appended</td><td>true</td><td>_</td></tr></tbody></table>

### Returns

This node does not return any value, but sets a variable with your provided `<name>` in the flow context.


# Contains

The **Contains** node is  used to check if an array consist of some value

### Properties Panel

#### General

<table data-full-width="false"><thead><tr><th width="244">Field</th><th>Description</th><th>Required</th><th data-hidden>Default</th></tr></thead><tbody><tr><td>Node name</td><td><a href="/pages/jJ1qO0Ju8d7VFyPB2Jy3"><mark style="color:blue;"><strong>Checkout Node name</strong></mark></a></td><td>true</td><td>_</td></tr><tr><td>Variable name</td><td>Name of array where you need to check</td><td>true</td><td>_</td></tr><tr><td>Value</td><td>Value to be checked</td><td>true</td><td>_</td></tr></tbody></table>

### Returns

`result` - The result of the Contains node at runtime. You can access this using Magical Autocomplete (eg. `$.<node_name>.result`) in any node below this node


# Check array empty

The **Contains** node is  used to check if an array is empty or not

### Properties Panel

#### General

<table data-full-width="false"><thead><tr><th width="244">Field</th><th>Description</th><th>Required</th><th data-hidden>Default</th></tr></thead><tbody><tr><td>Node name</td><td><a href="/pages/jJ1qO0Ju8d7VFyPB2Jy3"><mark style="color:blue;"><strong>Checkout Node name</strong></mark></a></td><td>true</td><td>_</td></tr><tr><td>Variable name</td><td>Name of array to check if it is empty</td><td>true</td><td>_</td></tr></tbody></table>

### Returns

`result` - The result of the `Check empty array` node at runtime. You can access this using Magical Autocomplete (eg. `$.<node_name>.result`) in any node below this node


# Extend array

The **Extend array** node is  used to extend values in an array

### Properties Panel

#### General

<table data-full-width="false"><thead><tr><th width="244">Field</th><th>Description</th><th>Required</th><th data-hidden>Default</th></tr></thead><tbody><tr><td>Node name</td><td><a href="/pages/jJ1qO0Ju8d7VFyPB2Jy3"><mark style="color:blue;"><strong>Checkout Node name</strong></mark></a></td><td>true</td><td>_</td></tr><tr><td>Variable name</td><td>Name of array to extend values in</td><td>true</td><td>_</td></tr><tr><td>Values to extend</td><td>Value to be extended in given array</td><td>true</td><td></td></tr></tbody></table>

### Returns

This node does not return any value, but sets a variable with your provided `<name>` in the flow context.

### Example

Let's assume we have two variables declared in our flow&#x20;

* val\_one = `[1, 2, 3, 4]`
* val\_two = \[`5, 6, 7, 8]`

Now to extend values of **val\_two** in **val\_one** we have to set&#x20;

* Variable name  = `$.variables.val_one`
* Values to extend = `$.variables.val_two`

This would change variables as&#x20;

* val\_one = `[1,2,3,4,5,6,7,8]` (changes the original value)
* val\_two = `[5,6,7,8]` (stays the same)


# Get Array Item

**Get Array Item** node is designed to extract a specific item from an array based on its index. This node is particularly useful when you need to access a particular element within an array for further processing or output in your workflow.

### Properties Panel

<table data-header-hidden><thead><tr><th width="147"></th><th width="413"></th><th></th></tr></thead><tbody><tr><td><strong>Field</strong></td><td><strong>Description</strong></td><td><strong>Required</strong></td></tr><tr><td>Node name</td><td><a href="/pages/jJ1qO0Ju8d7VFyPB2Jy3">Node Name</a></td><td>true</td></tr><tr><td>Variable Name</td><td>The name of the variable where the extracted item will be stored</td><td>true</td></tr><tr><td>Item Index</td><td>The index of the item to be extracted from the array (0-based)<br><br><code>-len(arr) &#x3C;= i &#x3C; len(arr)</code></td><td>true</td></tr><tr><td>Lookup Array</td><td>The array from which the item will be extracted</td><td>true</td></tr></tbody></table>

### Usage

1. Specify a variable name where the extracted item will be stored.
2. Enter the index value of the item you want to extract (remember that array indices start at 0).
3. Provide the lookup array from which the item will be extracted.

### Returns

The node stores the extracted item in the specified variable. You can access this using Magical Autocomplete (e.g., `$.variables.<variable_name>`) in any node below this node.

### Example

Let's say you have an array of user objects fetched from database using [List Records](/flow-builder/node-types/database-nodes/list-records) node and you want to extract the second user:

1. Set Variable name to `second_user`
2. Set Index value to 1 (remember, arrays are 0-indexed)
3. Set Lookup array to `$.listRecords.result` (assuming you're using `List Records` node and it's name is `listRecords`)

This will store the second user object in the variable `second_user`. You can then use this in subsequent nodes by `$.variables.second_user`

### Best Practices

* Always ensure that the index value is within the bounds of the array. Attempting to access an out-of-bounds index may result in an error.
* Negative Index are supported for extracting values from back but make sure it's within the size of lookup-array.
* Remember that array indices start at 0, so the first item is at index `0`, the second at index `1`, and so on.
* If you need to access the last item in an array of unknown length, you can use `-1` as index value.
* When working with potentially empty arrays, consider adding a condition to check the array length before attempting to extract an item.


# Length of array

The **Length of Array** node is  used to check length of array

### Properties Panel

#### General

<table data-full-width="false"><thead><tr><th width="244">Field</th><th>Description</th><th>Required</th><th data-hidden>Default</th></tr></thead><tbody><tr><td>Node name</td><td><a href="/pages/jJ1qO0Ju8d7VFyPB2Jy3"><mark style="color:blue;"><strong>Checkout Node name</strong></mark></a></td><td>true</td><td>_</td></tr><tr><td>Variable name</td><td>variable name to store result</td><td>true</td><td>_</td></tr><tr><td>Array To find the length</td><td>Name of array to check the length </td><td>true</td><td></td></tr></tbody></table>

### Returns

This node does not return any values but create a new variables with result . You can access it using magical autocomplete using `$.variables.<Variable name>`


# Reverse array

The **Reverse Array** node is used to reverse elements of an array

### Properties Panel

#### General

<table data-full-width="false"><thead><tr><th width="244">Field</th><th>Description</th><th>Required</th><th data-hidden>Default</th></tr></thead><tbody><tr><td>Node name</td><td><a href="/pages/jJ1qO0Ju8d7VFyPB2Jy3"><mark style="color:blue;"><strong>Checkout Node name</strong></mark></a></td><td>true</td><td>_</td></tr><tr><td>Variable name</td><td>variable name of array to reverse</td><td>true</td><td>_</td></tr></tbody></table>

### Returns

This node does not return any values but create a new variables with result . You can access it using magical autocomplete using `$.variables.<Variable name>`


# Sort array

The **Sort array** node is  used to sort array in either ascending or descending order.

### Properties Panel

#### General

<table data-full-width="false"><thead><tr><th width="244">Field</th><th>Description</th><th>Required</th><th data-hidden>Default</th></tr></thead><tbody><tr><td>Node name</td><td><a href="/pages/jJ1qO0Ju8d7VFyPB2Jy3"><mark style="color:blue;"><strong>Checkout Node name</strong></mark></a></td><td>true</td><td>_</td></tr><tr><td>Variable name</td><td>Variable name to store result</td><td>true</td><td>_</td></tr><tr><td>Array to sort</td><td>Values to sort</td><td>true</td><td></td></tr><tr><td>Key to sort by</td><td>Key to sort array by </td><td>false</td><td></td></tr><tr><td>Sort order</td><td>Ascending or Descending</td><td>false</td><td></td></tr></tbody></table>

### Conditional fields

**Key to sort by :**  This field is required if array to sort have dict/object values. e.g.

```javascript
[
  {
    name: "john",
    age:20
  },
  ...
]
```

If you want to sort this list based of age then you can specify `Key to sort by` as `age` &#x20;

### Returns

This node does not return any values but create a new variables with result . You can access it using magical autocomplete using `$.variables.<Variable name>`


# Date and Time


# Set current datetime

**Set current datetime** node is designed to capture and store the current date and time in a specified format. This node is particularly useful when you need to timestamp events, record the exact time of an operation, or work with time-based data in your workflow.

### Properties Panel

| **Field**       | **Description**                                                                                                                                              | **Required** |
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------ |
| Node name       | [Node Name](/flow-builder/node-name)                                                                                                                         | true         |
| Variable name   | The name of the variable where the current datetime will be stored                                                                                           | true         |
| Datetime format | <p>The format in which the datetime should be stored<br>Options - <code>ISO Datetime</code>, <code>Epoch Seconds</code>, <code>Epoch Milliseconds</code></p> | true         |

### Usage

1. Specify a variable name where the current datetime will be stored.
2. Select the desired format type for the datetime

### Format Types

The node supports three format types for storing the datetime:

1. `ISO Datetime`: Returns the current datetime in ISO 8601 format (e.g., "2024-07-22T10:30:00.000Z")
2. `Epoch Seconds`: Returns the current time as Unix timestamp in seconds (e.g., 1721234567)
3. `Epoch Milliseconds`: Returns the current time as Unix timestamp in milliseconds (e.g., 1721234567000)

### Returns

The node stores the current datetime in the specified variable. You can access this using Magical Autocomplete (e.g., `$.variables.<variable_name>`) in any node below this node.

### Example

Let's say you want to record the exact time a user action was performed:

1. Set Variable name to `action_timestamp`
2. Set Format type to `ISO Datetime`

This will store the current datetime in ISO format in the variable `action_timestamp`. You can then use this timestamp in subsequent nodes.

### Best Practices

* Be aware of timezone implications when using `ISO Datetime`. The timestamp is generated in the server's local timezone.


# Strings


# Append String

The **Append String** node is used to append values to the end of a string. This operation concatenates the specified values, extending the original string.

### Properties Panel

#### General

| **Field**         | **Description**                                                                      | **Required** |
| ----------------- | ------------------------------------------------------------------------------------ | ------------ |
| Node name         | [Node Name](https://docs.cosmocloud.io/concepts-and-in-depth/flow-builder/node-name) | true         |
| Variable Name     | Name of string in which the values need to appended.                                 | true         |
| Strings to append | Values to be appended                                                                | true         |

### Example 1

Let's say you want to append name to greeting. Greeting is stored in `$.variables.greeting`.

1. Set Variable Name to `$.variables.greeting`.
2. Set value to `Ravi`.

It will append the `Ravi` string to string present in `$.variables.greeting`. The variable `$.variables.greeting` will contain the appended string. If such variable doesn't exist, it'll raise an error.

### Example 2

Let's say you want to append name to greeting. Greeting is stored in `$.variables.greeting`. Name is stored in `$.variables.name`.

1. Set Variable Name to `$.variables.greeting`.
2. Set value to `$.variables.name`.

It will append the string present in `$.variables.name` to string present in `$.variables.greeting`. The variable `$.variables.greeting` will contain the appended string. If one of the variables doesn't exist, it'll raise an error.

### Returns

This node does not return any value, but sets a variable with your provided `<name>` in the flow context.


# Concat Strings

The **Concat Strings** node is used to concatenate two or more strings together. It combines the specified strings into one. The resulting concatenated string is then stored in a new variable.

### Properties Panel

| **Field**              | **Description**                                                                      | **Required** |
| ---------------------- | ------------------------------------------------------------------------------------ | ------------ |
| Node name              | [Node Name](https://docs.cosmocloud.io/concepts-and-in-depth/flow-builder/node-name) | true         |
| New string name        | Name of the new variable in which the concatenated string would be stored            | true         |
| Strings to concatenate | Values or Variables containing strings needs to be concatenated                      | true         |
| Delimiter              | The character or set of characters that is used to separate each concatenated value  | false        |

### Example

Let's say you want to generate the full name of user from user's first and last name. User First Name is stored in `$.variable.firstname` User Last Name is stored in `$.variable.lastname`

1. Set `New string name` to `full_name`.
2. Set `Strings to concatenate` to `$.variable.firstname`
3. Click `New Value` Button in `Strings to concatenate` section.
4. Set `Strings to concatenate` to `$.variable.lastname`
5. Set `Delimiter` to (in case you want space between first and last name else leave blank).

It will append the string present in `$.variable.firstname` to string present in `$.variables.lastname`. The variable `$.variables.fullname` will contain the concatenated string. If the variable `$.variables.fullname` does not exists, then it will create a new variable. If it exists, it would overwrite the value with the concatenated string.

### Returns

This node does not return any value, but sets a variable with your provided `< New string name>` in the flow context.




---

[Next Page](/llms-full.txt/1)

