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

Hi,
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.

Reason:
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(ScriptEngine.java:199)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:442)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:433)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:412)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:404)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:281)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:142)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:133)
at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)

You need to write an import statement for JsonSluper class.