I have tried running the code as given in the katalon docs link below but it does not seem to append the query parameters.
https://docs.katalon.com/katalon-studio/docs/web-services-builder.html
Here is script which is in the above link too. Adding a statement like println requestObject.restUrl shown url without query params and the response contains data for all ids, instead of id requested.
Can someone please take a look? Thanks!
import com.kms.katalon.core.testobject.ConditionType as ConditionType
import com.kms.katalon.core.testobject.RestRequestObjectBuilder
import com.kms.katalon.core.testobject.TestObjectProperty as TestObjectProperty
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
'Create a new GET object using builder'
def builder = new RestRequestObjectBuilder()
def requestObject = builder
.withRestRequestMethod("GET")
.withRestUrl("http://jsonplaceholder.typicode.com/comments")
.withRestParameters([
new TestObjectProperty("postId", ConditionType.EQUALS, "1"),
new TestObjectProperty("id", ConditionType.EQUALS, "1")
])
.withHttpHeaders([
new TestObjectProperty("Content-Type", ConditionType.EQUALS, "application/json")
])
.build()
//HERE ---- println requestObject.restUrl does not show the query params
'Send a request'
def response = WS.sendRequest(requestObject)
'Verify if comment\'s email after sending request is correct or not'
WS.verifyElementPropertyValue(response, '[0].email', 'Eliseo@gardner.biz')
//HERE – response contains all ids instead of expected filtering by id