How to send HttpHeader value of x-api-key while sending request in REST Api tests

Hi,

Please suggest how to send Http headers(x-api-key) and variables during run time i.e: while sending request in test case.
response = WS.sendRequest(findTestObject(‘Object Repository/API/_api_file_upload/POST’)).
and… ?

Thanks

1 Like

Please follow this documentation-
https://docs.katalon.com/katalon-studio/docs/parameterize-a-web-service-object.html#for-restful-request

For the HTTP Header Katalon is supporting Key and Value pairs.

Like-

‘Send the request with jwt token’

ResponseObject getResponse = WS.sendRequest(findTestObject(‘Object Repository/OR JwtToken/GetRequest - Jwt’, [(‘jwt_token’) : token]))

‘Assert on the status code’

Assertions.assertThat(getResponse.getStatusCode()).isEqualTo(200)

Hope this will help you.

Thanks Happy Testing.