Forum Discussion

AAB's avatar
Regular Contributor
5 years ago

How to put a parameter from a JSON URL response in a REST Request



For my project I need to read a JSON response through a URL. I've managed to do so, but now I should put a particular property into the REST Request. How can I do this please?

So far:

import groovy.json.JsonSlurper

def getConceptSchemes = "https://LinkToMyEnvironment".toURL().getText()
//parse json string using JsonSlurper - basically converts it to a groovy list
def parsedJson = new groovy.json.JsonSlurper().parseText(getConceptSchemes)
//get data
def findAGC = parsedJson.find { == 'ACTIVITY_GROUP' } "result for specific beID: " + findAGC

This gives me the answer from the Json response.

This is a first step in my TestCase.

The second step is a REST Request with parameter 'beId' that I need to fetch from the response.



How can I do so please?


Thanks in advance


2 Replies