Hi all
so I read through a previous post:
With the same error and I applied the code but I still get the error. any help will be great
I need to parse the GUID that is returned from the api into a GlobalVariable…
My API
https://xxxxx/api/getrequest/requirementshistoryid?requirementsHistoryId=${reqGUID}
it returns a GUID and not in a string
6b53851d-045b-4d1a-805b-c226cbc7c590
My Code
import com.kms.katalon.core.webservice.verification.WSResponseManager as WSResponseManager
import groovy.json.JsonSlurper as JsonSlurper
import groovy.json.JsonSlurper
tokenGen().toString()
def token
String tokenGen() {
def tests = WS.sendRequest(findTestObject(‘Lancet APIs/Get_History_ID’, [(‘reqGUID’) : GlobalVariable.ReqGUID, (‘lanAuth’) : GlobalVariable.lanAuth]))
def jsonSlurper = new JsonSlurper()
def slurper = new JsonSlurper()
def result = slurper.parseText(tests.getResponseBodyContent().toString())
def token = result
WS.verifyResponseStatusCode(response, 200)
println(token)
GlobalVariable.gethistoryId = token
}