Skip to content

How do I access a REST service which has URL/Query parameters

This example demonstrates accessing a REST service with URL parameters.

In the solution shown below, the command "wsSetRequestURLParam" takes input parameters from URL i.e., assetType = 1 and constructs the URL. when the command "wsExecuteRequest" executes, it returns Screenshots metadata generated for given Run Id. "weSetRequestURLParam" command can be used multiple times if there are multiple query parameters.

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/< place_domainName_here >/executions/ < place_runId_here >/assets
URL
To set the URL for Triggering Runs Using Worksoft SaaS QaCONNECT REST API
4 wsSetRequestURLParam
assetType
1
To set the type of request method to hit the appropriate service  
5 wsSetRequestMethod
GET

To set the authentication type - Basic
6 wsAuthenticationType Basic
To set the Username to login to Worksoft SaaS Domain
7 wsSetUsername
your user name
To Set the Password to login to Worksoft SaaS Domain
8 wsSetPassword your password
To set the request body format and output type
9 wsSetRequestHeaderParam Content-Type
application/json
Execute the Service Request
10 wsExecuteRequest
${URL}
Response
To get the response code
11 wsGetResponseHttpStatusCode
Status_Code

End of a web service Block
12 wsBlockEnd


Tips, Tricks, Gotchas & Best Practices:  

  • You can provide multiple URL parameters by providing the "wsSetRequestURLParam" command multiple times.

Feedback and Knowledge Base