How to pass dynamic values to another from one api to another

How can I pass the value from response of POST to a GET request.
For eg. I have a POST api Login and GET api Result. Few variables in Login response are dynamic.
I need to use these dynamic values to be passed to my GET request. How can I do that? Please help me.

Katalon Studio GUI provides some sample projects bundled in the GUI menu.

  • File > New Sample Project > Sample API Test Project

will give you a Sample API Test project.

The project includes a Test Case “Find user by ID”

This script would be a good enough example for you.

It makes 2 HTTP sessions. The 1st HTTP session returns an integer value “id”, which is passed to the 2nd HTTP session.

1 Like

I tried going to * File > New Sample Project > Sample API Test Project but I am getting error - "Unable to clone git project "

I could do it on my Mac yesterday. I am sure the sample repository is available to everyone.

I guess you have some particular network configuration (such as VPN, proxy to internet etc) which causes you not to be able to access the repository. I have no idea about it.

So when i hit POST request, the JWT and one more variable(say A) keeps changing. I have to pass these JWT and variable A to GET request to get success response. Unable to figure out how I can do that.

I tried by referring to this video

but now I am seeing error with groovy.

Test Cases/APITesting FAILED.

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
file:/Users/ss11/Katalon%20Studio/TestAPI/Scripts/APITesting/Script1648965990465.groovy: 25: unable to resolve class JsonSlurper
@ line 25, column 15.
def slurper = new JsonSlurper()

1 error

at com.kms.katalon.core.main.ScriptEngine.getScript(
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(
at com.kms.katalon.core.main.TestCaseExecutor.runScript(
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(
at com.kms.katalon.core.main.TestCaseExecutor.execute(
at com.kms.katalon.core.main.TestCaseMain.runTestCase(
at com.kms.katalon.core.main.TestCaseMain.runTestCase(
at com.kms.katalon.core.main.TestCaseMain$runTestCase$ Source)

You need to write an import statement for JsonSluper class.