POST method- how to dynamically pass a name value that has to be unique everytime in json

I am trying to create entity, but this entity name has to be unique every time/run, otherwise it will not created. So I want to suffix with a random number, how i can do that using the Katalon tool. Is it possible? We have example for GET , I couldn’t find one for POST. Thank you

1 Like

Kalpana,

Parameterization technique is the same for GET and POST. You can create param in the json with ${variable} and then passing the value in the test case where calling the api

@Eitan Nakash
One of a solutions is making random number as a variable. It meant in the HTTP Body, set the _Random as a variable, then when you call the request at test case, create a new variable and set its value to a random number, then passing it value to the request

Your keywords is not in correct format. When you create a new keyword, there would be some examples and you need to use that format with @keyword annotation.

Data type “String” is good for your case.

But if would like to do it from the UI, it is not working for me yet.

It is not possible to do it directly only in the UI in one place.
You can, as previously said, use a variable (string), but u will have to set that variable to a random value yourself before calling the Send request.

And maybe you can do a Feature request in the Forum to have the possibility to use a kind of formula for the Default value for a variable (like in Excel: =Random_number() )

Hi Eitan,

I was able to use variable inside HTTP Body and then used replace function to get the value from another variable in the script. See the attached screenshot for more details.

image.png

hi How to pass values to ${variable} in test cases