How to get API Response verification status

I have created object repository with verification tab code. my verification tab code is given below

RequestObject request = WSResponseManager.getInstance().getCurrentRequest()
ResponseObject response = WSResponseManager.getInstance().getCurrentResponse()
WS.verifyElementPropertyValue(response, ‘result’, ‘Created’)
WS.verifyResponseStatusCode(response, 201)

how do I get my verification status from my test case?

What do you mean by the word “verification status”?

Our API endpoint consistently returns a 200 status code. However, we have added additional verification conditions in the verification tab of the API object repository. Occasionally, these verifications fail even when we receive a 200 response code. Unfortunately, I am unable to capture these verification failures in my script.

Here is the code snippet that represents my current method:

def static generateAPIStatusJSON(RequestObject request) {
ResponseObject response = WS.sendRequestAndVerify(request, FailureHandling.OPTIONAL)
int statusCode = WS.getResponseStatusCode(response)
def status = (statusCode == 200 || statusCode == 201) ? ‘Success’ : ‘Fail’

def jsonObject = [
    Environment: RC.getExecutionProfile(),
    Method: request.getRestRequestMethod(),
    Endpoint: request.getRestUrl(),
    Status: status,
]

return jsonObject

}

I would greatly appreciate any guidance on how to capture these verification failures in my script, considering the consistent 200 response code. Thank you in advance for your assistance.

Those are the verification snippets which runs when you trigger it manually from the request edit window or call it from a testcase with sendRequestAndVerify.
Using this method you don’t have full control over it from testcase.
It will just mark the step in your testcases as passed of failed.

For a fine grain control you may like to use sendRequest instead and implement any verification needed in the testcase, by accesing the response object various properties, either by using various verification keywords or writting your own assertions.
Start to read here:

https://docs.katalon.com/docs/create-tests/create-test-cases/using-web-services-in-a-test-case-in-katalon-studio

See also the response object doc:
https://api-docs.katalon.com/com/kms/katalon/core/testobject/ResponseObject.html

look also here:
https://docs.katalon.com/docs/create-tests/keywords/keyword-description-in-katalon-studio/web-service-keywords/ws-send-request