Parameterize a Web Service Object


#1

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

#2

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.


#3

Check out this link,

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


#4

You try same process:

“Field” : ${Field}

add Field to Variables


#5

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


#6

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


#7

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


#8

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


#9

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


#10

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

https://tools.ietf.org/html/rfc3986#section-2.2


#11

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:


#12

use \ for escaping


#13

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


#14

How to use variables in verification step for rest API?


#15

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


#16

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


#17

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
}


#18

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

“transaction_id”: ${transaction_id}

#19

Thanks bro .


#21

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.