Parameterize a Web Service Object


This is a companion discussion topic for the original entry at https://docs.katalon.com/katalon-studio/docs/parameterize-a-web-service-object.html

Hello!!
I need to pass parameterized Body from test Case, How can I achieve that?
I tried lot other options available but didn’t get any help.

thanks in advance.

Check out this link,

it explains how to add global variables which can be manipulated in your test case for webservices

1 Like

You try same process:

“Field” : ${Field}

add Field to Variables

1 Like

Hello,

please, advice how you handle the following scenario

need to pass variable with dynamically generated random string, in my case

Variable

message_id = randomString

Thanks

Click the above link, it explains how to make a Global Variable.

Once made within your test case scripting area simple assign your randomly generated variable to it like this:

GlobalVariable.MyVariableName = message_id

I need to pass parameterized values in the HTTP Body -> Form-data section How can I achieve that in Katalon?

My Verification tab got hide how can i get that back ?What command or keys needs to press to get it back?

Hi ,

My rest post URL contains $ in it. Since $ is used in Katalon to use as a variable, how to escape $ in the URL.

https://some.test.com/datval/Sessions?$numb=10&$search=id 7&$presence=yes

Thanks,
Vedesh

Vedesh

The “$” character is a reserved character and you should not use it in a URL (unless it is previously percent-encoded before building the URL string).

image

Can you help with variables in HTTP_Body
I try to send variables like this:

{
  "clientId": $login,
  "password": $password
}

but this don’t working :frowning:

use \ for escaping

try to use variables in headers, not working
Work only in parameters for URL

How to use variables in verification step for rest API?

how to use the variable for url and have it working in the testcase for different environments as well ?

Can anybody reply variables don’t seem to be working in body, headers…

please help me.
my API only works like this
{
“command_type”: “purchase”,
“transaction_id”: 1,
“transaction_biller_id”: 1
}

i want to get the global variable to transaction_id .
please help me how to write it .
{
“command_type”: “purchase”,
“transaction_id”: “${transaction_id}”, <-------- this doesnt work, because it becomes string. ineed number
“transaction_biller_id”: 1
}

don’t use quotes around the variable
try like this (provided the global needed is defined properly, as a number):

“transaction_id”: ${transaction_id}
1 Like

Thanks bro .

Hi, I want to use variable (server hostname and port) from execution profile as parameter in REST API URL. How to do it in Katalon?

In Postman, it is incredibly easy, just set hostname and port in environments, and use API URL as i.e. https://{{HOSTNAME}}:{{PORT}}/rest/v1.0/administration/clusters and it works.