Parameterize a Web Service Object

To reply to IBUS guy which is hiding behind some noreply adress…
this is my third try to use katalon in my project in last six months. And YES I DID read the docs. And tried everything, and NO, it is NOT easy like in postman.
If you do not want to help, stop mocking me. And YES, documentation SUCKS!

have you searched the forum too? you may find some answers …
amazing, katalon way is ${variable}.or … is the groovy way?

you have exactly one post above you started the new one an example where i show what the previous OP done wrong. did you read it?

Obviously I am not alone, and there is no example on how to do this…
My profile has two variables: host (set as string to host01) and port (set as string to 9876)… that’s all…
i tried REST API URL this ways:

  1. https://${host}:${port}/rest/v1.0/administration/clusters
  2. https://${}:${GlobalVariable.port}/rest/v1.0/administration/clusters
  3. … and everything else that came to my mind in last three installations of katalon.

And it throws errors when called.
I am pretty frustrated, as this should be easy, and I have no idea what I am doing wrong.

As I canot put more that three replies (what a retarded rule), I have to edit previous reply and hope that someone see this:
In profile, I set global variables g_bc and g_port.
Then click send request.
Error is:
Cannot send the test request.
For input string: “${g_port}”. For input string: “${g_port}”
at com.kms.katalon.core.webservice.common.RestfulClient.sendRequest(
at com.kms.katalon.core.webservice.common.RestfulClient.send(
at com.kms.katalon.controller.WebServiceController.sendRequest(
at org.eclipse.jface.operation.ModalContext$
Caused by: java.lang.NumberFormatException: For input string: “${g_port}”
… 5 more

If I put port by number and hostname in URL, everything works. But using ${var} is not working.

Well it finally worked, and I have no idea why it was not working before.
I used again URL format I used in method 2: ${GlobalVariable.var} format, and now it works. This is really strange behavior.

what errors did you get? did you set the appropiate headers in the request objects? or do you expect katalon to do all the ‘underhood magic’ for you?

I’m having a related issue, attempting to authenticate to my API via parameters/variables

A GET request:


${url} and ${username} and ${password} are all variables of type String, the default values of which are all seemingly correct.

My API returns:
“message”:“Required String parameter ‘password’ is not present”,
Which I find confusing. Any hints?

The event log says this:

15:22:52.219 [ModalContext] INFO com.kms.katalon.core.webservice.common.HarLogger - HAR: C:\Users\awedd\AppData\Local\Temp\3\har8268017398050496001\requests\ModalContext\60.har

Thu Sep 12 15:22:52 AEST 2019 Connection refused: connect
at Method)
at com.kms.katalon.application.utils.ServerAPICommunicationUtil.sendAndReceiveData(
at com.kms.katalon.application.utils.ServerAPICommunicationUtil.invoke(
at com.kms.katalon.tracking.service.TrackingService.sendEventPayload(
at com.kms.katalon.tracking.service.TrackingService.lambda$0(
at java.util.concurrent.Executors$
at java.util.concurrent.ThreadPoolExecutor.runWorker(
at java.util.concurrent.ThreadPoolExecutor$

are the variables global (defined in profile) or local (declared in the request object)?

@Ibus I believe I have tried both methods to no avail

@adrian.wedd ok, let’s take it step by step.
we are going to use a free test api:

So, kindly reproduce exactly my setup, see the pics: make an request object, set the headers, set the local variables and press the green ‘play’ button. you should get the same response:

Once you confirm is working for you too, we move forward. Otherwise, you did something wrong … or you have connectivity issues.

** note also my katalon version, i am using 6.1.2. although not very important,check yours too to be sure we are almost on the same page.
some versions were known to be buggy

@Ibus Thanks.

I’m running 6.3.3 and I suspect I have a connectivity issue:

I’ll look into that. Interestingly 6.3.3 seems to think I had an illegal character in my url. Presumably “$”?

switch to the ‘Variables Editor’ tab an post a complete screenshot. you may have a mistyping somewhere.

Well spotted @Ibus.


Presumably my issue (aside from \r\n above) indeed looks to be connectivity. I’ll look at the firewall issue and get back to you tomorrow. Thanks for your hand-holding :slight_smile:

it’s ok, happened to me also … the implementation of the variables tab is not the best, if you press enter after you paste a string such issue may occur.
once you figure out what is wrong with your networking we move forward to use globals

Can i define the local variable like systemDate in Verifications tab and call it in HTTP json body?

def date = new Date()
sdf = new SimpleDateFormat(“YYYY-MM-dd”)
def systemDate= sdf.format(date)

In Json body:




Do I define this variable under “Variables” tab to pull in my json body? if so, how do i define this as local variable?

Wondering how to use the List variables within the Web Service Request. Do you call it like a string or do you have to write it different within the body?

Is there a way to send a parameter as a boolean and not a string ?
My case : where I type ${urlPassCollecte}/api/user-profil/${adh}?msgInfo=false as the request URL, Katalon generates
“queryString” : [ {
“name” : “msgInfo”,
“value” : “false”
} ]
(with double-quotes around false value), casting i fact the boolean to a string value.
The API under tests expects a boolean (the same QueryString without the double-quotes around false) and therefore answers an error to my request.
Any clue ?
Tanks in advance,

an url in the end is just a string, no matter if some tools are able to split what is after ? as key=val parameters.
looks for me like a bad designed API, it should be able to cast internally false | False | no | No into boolean

What about including a dynamic variable within the URL of the GET? I have tried but it does not work.

Included the variable in the test case: category_id, number, default value 0.

GET URL/product/${category_id}.json

WS.sendRequest(findTestObject(‘API/products’), [(‘category_id’) : categoryID])

It fails on the send request: Reason:
groovy.lang.MissingMethodException: No signature of method: static com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords.sendRequest() is applicable for argument types: (com.kms.katalon.core.testobject.RequestObject, java.util.LinkedHashMap) values: [TestObject - ‘Object Repository/API/products’, [category_id:15]]
Possible solutions: sendRequest(com.kms.katalon.core.testobject.RequestObject), sendRequest(com.kms.katalon.core.testobject.RequestObject, com.kms.katalon.core.model.FailureHandling)

Any help?
Thank you!

anybody knows a way to use a variable of type Map ?
I don’t find a correct syntax to get my withPAPG value from my Map variable

I tried ${params[‘withWCSParam’]}, ${params.withWCSParam}, $params.withWCSParam without achieving

it compose this kind of url :