Hi community , i am not able to print the payload and response from network tab in katalon console. can anyone respond me regards this

i’m facing some issue, while trying to catch payload

2 Likes

Please explain what you have done.

1 Like

what issue you are facing? what is the error ? share the error logs,

from network tab in katalon console

What is the “network tab in katalon console”? I have never seen such thing.

Could you provide a screenshot of the “network tab in katalon console”?

1 Like
import com.kms.katalon.core.webservice.keyword.WS
import com.kms.katalon.core.webservice.objects.RequestObject
import com.kms.katalon.core.webservice.objects.ResponseObject

// 1. Define your Request Object (assuming you have one in Object Repository)
// Or create one dynamically like this:
RequestObject request = new RequestObject()

// 2. Define the request details
request.setRestRequestMethod('POST')
request.setRestUrl('https://jsonplaceholder.typicode.com/posts')
request.setHttpHeaderProperties([new com.kms.katalon.core.webservice.common.HttpHeader('Content-Type', 'application/json')])

// 3. Set the payload (request body)
String payload = '{"title": "foo", "body": "bar", "userId": 1}'
request.setHttpBody(payload)

// 4. Print the Request Payload BEFORE sending
println "--- Request Payload ---"
println request.getHttpBody()
println "-----------------------"

// 5. Send the request and get the response
ResponseObject response = WS.sendRequest(request)

// 6. Print the Response Body AFTER receiving
println "--- Response Body ---"
println response.getResponseBodyContent()
println "---------------------"

// Optional: Print the status code as well
println "Response Status Code: " + response.getStatusCode()

were you able to catch the payload with the above example @chetan.chavan

2 Likes