Queries on RestAPI Automation using Katalon

Hi All,

I am exploring katalon 5.4.2 for Rest API automation in my project. I found it pretty useful but currently stuck due to below queries

1. My Project is having some base url which is common across all REST APIs which i want to automate. I need to set this base url in my object repository where all my API objects are created. How can we do this ? in my case base url may get change depending on the environment i am going to use for test so if i hard-code the base url in object repository everytime i need to change it for all APIs. Can this be achieved via Execution profiles functionality , if yes how?

2. In my project i need to execute login API which generates token which is then need to use in all other APIs, so i need to store this token value generated by login API as global variable and then need to use it all APIs, How can i achieve this ?

Any pointers will help in proceeding further.

Vishwas Pathak


I think you will need to upgrade to our new release V5.5 to achieve better options for your cases.
1. In 5.5, Katalon Studio support parameterize feature for Web service object. It means you can use url with parameter (ie a GlobalVariable) so that you don’t need to change multi places with different url.
2. You can do this via Listener (ie BeforeTestCase listener). First, calling the api getting the token, then add it into a variable at runtime. You can put this function into BeforeTestCase listener. From this execution section, the global variable has token and you can use it in any place (ie Webservice Object header).

Thanks Trong,

I updated to version 5.5 and tried # 1 mentioned in your above response but not able to achieve it. can you please point me to some documentation with screenshots to do this.

This is the same scenario in my project too. My approached was the below way
1. First create your api request object in the object repository as shown in below. Here I am app_env_url is the url which changes as per the environment.

You can define the application url in the environment profile and pass it in the RequestObject in the test case.

2. The Token creation test you can call from BeforeTestSuite() method in the Test listener.
If your project have both UI and API tests then you can define mutiple Environment profile to differentiate between UI and API test suites(Eg : QA UI, QA API env profiles). The create token test can be avoided for UI test if the environment profile name has UI in it.

Hope this helps you.

Screenshot (68).png

Screenshot (69).png


Hi Binisha,

Thanks for reply.

Just to note i am using Katalon studio version 5.5.0

I tried what you suggested but after these changes i am not to run my log API in object repository
please see below images -
First image is shows my execution profile where i have set base URL

Second image shows the test case code.

Third image shows object repository where i have set base url variable defined in my test case

With these when i am trying to run login API in my object repository then it is not doing anything after hitting Run button

Please reply this is really blocker for me as of now




Hi Vishwas,

_"_With these when i am trying to run login API in my object repository then it is not doing anything after hitting Run button"

Are you hitting play button in the object repository? then it wont work.
Click on the Play button from the test case after selecting the right Environment profile.

I am using 5.4. 2 version.


You need to remove testRequest.setRestUrlGlobalVariable.Neuro_base_url) step since you are already passing the base url in the previous step.