Is there a way to capture, view or log a Restful API call made from Katalon

Hi there,

We understand your concern. However, those kinds of logs are not supported in current release yet. We’ve planned to do this in later releases.

Thanks

1 Like

I see I can get the response. I want the POST request, AS SENT.
When I use a product like Soap UI, I can see the raw request:

POST https://auth-env2.myserver.net/api/auth/oauth2/token HTTP/1.1
Accept-Encoding: gzip,deflate
Authorization: Basic realm=myserver.NET&grant_type=password&username=logon&password=password&timestamp=1487626351&nonce=b1j670
InstitutionId: 123456789
Content-Type: application/json
Content-Length: 0
Host: auth-env2.myserver.net
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)

is there a way to log this?

Hi there,

In your case, you can use ‘getResponseBodyContent’ function after you sending a request. This way you can display responsed content after sending a request.

Example

‘Send a SOAP request and returns its response’
def response = WS.sendRequest(findTestObject(‘SOAP_ConvertWeight’))

println response.getResponseBodyContent()

Output example:

3000

Hello!

I have the same problem.

When your have resolution? In what version?

Thanks.

I would like to see my requests that are sent out also, is this implemented yet? or is it coming soon?

+1

I have the same issue.

Is it possible to print request in the script mode?

For response, I use println(response.getResponseText()) to get the response text logged when running the test case.
However, I could not sort it out how to print the outgoing request.

Anyone, any idea?

I also have the same problem

I am using something like this:

request = findTestObject('blahBlahYourRequestObjectHere')
    
'When'
WS.comment("Sending POST request: ${request.getRestUrl()}")
WS.comment("With body: ${request.getHttpBody()}")
response = WS.sendRequest(request)

to display the request info into the log (will be recorded also in the html report)
if you set the log level to TRACE, will be shown also into the console log (or use println instead)

1 Like

request = findTestObject (‘create transaction/shareFolder - Copy’)

println (WS. comment ( request.getRestUrl()))

println(WS. comment ( request.getHttpBody()))

not working for me . it is the correct for me

Thank you everyone for the feedback. Since 5.9.1 all API calls are saved as HAR files. Their locations are written in the logs.

1 Like

use either println, or WS.coment, not both combined in the same line

WS.comment(request.getRestUrl())
OR
println( request.getRestUrl())

1 Like

@devalex88 can you please explain how to find those files? I can’t find any .har files after GET requests. I’m using:

image

In 5.10.0 this function has to be enabled manually

We have plan to enable it by default in next versions.

3 Likes

So the HAR files are generated only a test case runs? Is it possible in any way to see request’s header when I just click this button?

1 Like

Unfortunately it is not available at this moment, but you will have it in next versions.

As a workaround, please take a look at Fiddler.

2 Likes

Thanks! I’ve installed it and got all the info.

1 Like

Try this. !!!

‘For logging request’
System.out.println(request.getHttpBody())

‘For logging response’
System.out.println(response.response.getResponseBodyContent())

@ devalex88
still there are issues, we are not able to see the response in logs

how to fetch these data in katalon