Skip to content

How do I set the Header parameters and access a REST service

This example demonstrates on setting the Header parameters and access a REST service.

In the solution shown below, you set the request header parameters for the REST service under test using the "wsSetRequestHeaderParam" command.

Solution:

# Command Target Value
Start of a web service block
1 wsBlockOpen

To set the Header Protocol
2 wsSetProtocol
REST
To set the request URL for getting the results of the test run
3 wsSetRequestURL
https://www.eureqatest.com/rest/v1/:domainname/executions
URL
To set the HTTP request format
4 wsSetRequestMethod
GET

To set the request body format and output type
5 wsSetRequestHeaderParam Content-Type
application/json
Execute the Service
6 wsExecuteRequest
${URL}
Response
To get the response code
7 wsGetResponseHttpStatusCode
Status_Code

End of a web service Block
8 wsBlockEnd


Tips, Tricks, Gotchas & Best Practices:  

  • You can repeat the command " wsSetRequestHeaderParam" with multiple header parameters


    Feedback and Knowledge Base