# How to use Global Variable directly in Object Repository URL

**URL:** <https://forum.katalon.com/t/how-to-use-global-variable-directly-in-object-repository-url/23635>\
**Category:** API Testing\
**Tags:** api-testing, katalon-studio\
**Created:** [April 23, 2019, 6:54am UTC](https://forum.katalon.com/t/how-to-use-global-variable-directly-in-object-repository-url/23635 "2019-04-23T06:54:01Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![sunalps2000](https://avatars.discourse-cdn.com/v4/letter/s/85f322/32.png) [@sunalps2000](https://forum.katalon.com/u/sunalps2000)\
**Post date:** [April 23, 2019, 6:54am UTC](https://forum.katalon.com/t/how-to-use-global-variable-directly-in-object-repository-url/23635/1 "2019-04-23T06:54:01Z")

</div>

HI,

I want to set Base URI in profile section and want to use it in Object Repository url.

For instance, if variable name in profile is BASE\_URI then in OR, I want to use it like ${BASE\_URI}/

---

<div class="post-metadata">

**Author:** ![Igi\_PL](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/igi_pl/32/1083_2.png) [@Igi\_PL](https://forum.katalon.com/u/Igi_PL)\
**Post date:** [April 23, 2019, 10:24am UTC](https://forum.katalon.com/t/how-to-use-global-variable-directly-in-object-repository-url/23635/2 "2019-04-23T10:24:00Z")

</div>

If you are using KS \< 6.1.0 this can be a problem (more info: [Can't use variables in Web Service Request URL](http://forum.katalon.com/t/cant-use-variables-in-web-service-request-url/22350)).  
My approach in 5.10.1:

1. Set Global variables in profile: “G\_URLProtocol”, “G\_URLHost” and “G\_URLPort”
2. In Object Repository → API request → Variables set local variables from global.
3. Build URL in “Endpoint” variable (screen). If you do not need protocol from variable or you are using KS =\> 6.1.0 you do not have to create this, just use local variables in rest URL.

 ![image](https://europe1.discourse-cdn.com/katalon/original/2X/5/53a69708fddd406c56222f9553aaf2256bde526d.png)

---

<div class="post-metadata">

**Author:** ![sunalps2000](https://avatars.discourse-cdn.com/v4/letter/s/85f322/32.png) [@sunalps2000](https://forum.katalon.com/u/sunalps2000)\
**Post date:** [April 24, 2019, 5:10am UTC](https://forum.katalon.com/t/how-to-use-global-variable-directly-in-object-repository-url/23635/3 "2019-04-24T05:10:13Z")

</div>

I am using Katalon 6.1.0 , I have 1000 APIs, do I need to create local variables for each of these APIs ?

---

<div class="post-metadata">

**Author:** ![Fhadel\_Fadillah](https://avatars.discourse-cdn.com/v4/letter/f/e9bcb4/32.png) [@Fhadel\_Fadillah](https://forum.katalon.com/u/Fhadel_Fadillah)\
**Post date:** [April 24, 2019, 12:20pm UTC](https://forum.katalon.com/t/how-to-use-global-variable-directly-in-object-repository-url/23635/4 "2019-04-24T12:20:38Z")

</div>

override it in the testcase using parameterized object may be efficient for this case ( in my perspective )

---

<div class="post-metadata">

**Author:** ![lakshmi.sriram](https://avatars.discourse-cdn.com/v4/letter/l/b9bd4f/32.png) [@lakshmi.sriram](https://forum.katalon.com/u/lakshmi.sriram)\
**Post date:** [September 30, 2019, 11:01am UTC](https://forum.katalon.com/t/how-to-use-global-variable-directly-in-object-repository-url/23635/5 "2019-09-30T11:01:19Z")

</div>

If youre using version 5.8.0 use the statement def requestObject = findTestObject(‘API/API NAMe’, [(‘Server’) : GlobalVariable.APIServer, (‘ServerName’) : ‘${Server}’]) as RequestObject  
in your code to make it a successful request

---

<div class="post-metadata">

**Author:** ![albert.vu](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/albert.vu/32/20595_2.png) [@albert.vu](https://forum.katalon.com/u/albert.vu)\
**Post date:** [August 8, 2022, 7:39am UTC](https://forum.katalon.com/t/how-to-use-global-variable-directly-in-object-repository-url/23635/6 "2022-08-08T07:39:39Z")

</div>

Archived on August 8, 2022, 7:39am UTC


