> For the complete documentation index, see [llms.txt](https://smartscenarios.pirichain.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://smartscenarios.pirichain.com/psce-functions/examples/connect-to-external-environments.md).

# Connect to EXTERNAL ENVIRONMENTS!

As you can see that below code is able to connect for getting data from external environments. **The important thing is system will need to fetch at least 11 different nodes defined endpoint url.**

{% code lineNumbers="true" %}

```javascript
 async function init(typeOfCoffee)
{
const allCoffee=await Tools.getData("https://api.sampleapis.com/coffee/hot");

//return allCoffee;
        if (allCoffee)
        {
            if (Array.isArray(allCoffee.data))
            {

                for (let i=0;i<allCoffee.data.length;i++)
                    if (allCoffee.data[i].title===typeOfCoffee)
                    {
                        return "You choosed Title :"+allCoffee.data[i].title+
                        " This Item Description : "+
                        allCoffee.data[i].description;
                    }
            }
        }
        return "You defined title , Not found!";
}
```

{% endcode %}
