---
title: "Environment Based URL in API Requests"
slug: "environment-based-url-in-api-requests"
description: "In this Test Modeller feature video, discover environment based URLs in API Requests."
tags: ["Automated Test Execution", "API Automation", "Get Started", "Test Modeller"]
updated: 2024-09-27T14:10:15Z
published: 2024-09-27T14:10:15Z
canonical: "knowledge.curiositysoftware.ie/environment-based-url-in-api-requests"
---

> ## Documentation Index
> Fetch the complete documentation index at: https://knowledge.curiositysoftware.ie/llms.txt
> Use this file to discover all available pages before exploring further.

# Environment Based URL in API Requests

In this Quality Modeller feature video, discover environment based URLs in API Requests.

Additionally, [**check out our QuickStart API Automation guide!**](/docs/quickstart-api-automation)

**[Embedded content](https://www.youtube.com/embed/KvKUbE_Iuvw?&amp;wmode=opaque&amp;rel=0)**

For this demo, we have a module collection with an API request set-up within **Quality Modeller**. The example API URL we are using is a hard coded JSON placeholder.

![](https://cdn.document360.io/77f722a6-2d0a-49fa-8074-572515a6c4b8/Images/Documentation/image-1680273217178.png)![](https://cdn.document360.io/77f722a6-2d0a-49fa-8074-572515a6c4b8/Images/Documentation/image-1680273221492.png)![](https://cdn.document360.io/77f722a6-2d0a-49fa-8074-572515a6c4b8/Images/Documentation/image-1680273227926.png)

From here, create a **New Environment Variable** using the **New Item button** from the **Models menu.**An environment variable is space for users to have a global variable they can share across different objects.

![](https://cdn.document360.io/77f722a6-2d0a-49fa-8074-572515a6c4b8/Images/Documentation/image-1680273233394.png)![](https://cdn.document360.io/77f722a6-2d0a-49fa-8074-572515a6c4b8/Images/Documentation/image-1680273239361.png)

Open the newly created**Environment Variable**and then click the**Blue Add Variable button.**This will open the New Variable menu, here give it a name and then add the URL in the Value field, for our example we are using the JSON placeholder URL.

![](https://cdn.document360.io/77f722a6-2d0a-49fa-8074-572515a6c4b8/Images/Documentation/image-1680273243530.png)![](https://cdn.document360.io/77f722a6-2d0a-49fa-8074-572515a6c4b8/Images/Documentation/image-1680273247888.png)

If you now navigate back to the **API Request menu**, in the demo we do this by opening the **JSONPraceholder module**in the **Model view,**hitting the **Edit Action tab**and opening the **API Request tab.**Review the screenshots at the top of this page to see a visual on how to access the API Request Tab.

This is where you can utilise the **global variable**, replace the current API URL with **[URL]**. Hit save and then regenerate the API request, what you will see now is the URL was replaced by the new Environment Variable.

![](https://cdn.document360.io/77f722a6-2d0a-49fa-8074-572515a6c4b8/Images/Documentation/image-1680273253709.png)![](https://cdn.document360.io/77f722a6-2d0a-49fa-8074-572515a6c4b8/Images/Documentation/image-1680273260037.png)

![](https://cdn.document360.io/77f722a6-2d0a-49fa-8074-572515a6c4b8/Images/Documentation/image-1680273273616.png)

This way you can have global variables which you can then pull in and consume in your set-up objects as parameters.

## Related

- [Automating Tests](/automating-and-executing-tests-in-test-modeller.md)
- [Quality Modeller 101](/test-modeller-101.md)
- [QuickStart API Automation](/quickstart-api-automation.md)
