How do I access a GET service - REST
|
|
This example demonstrates getting the execution status of a test run by accessing a GET service - REST.
In the solution shown below, the GET method is used to retrieve information from the given server using a given URI. The requests using GET only retrieve data and has no other effect on the data.
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 also Remotely trigger executions of automated tests in Worksoft SaaS and expect a Callback from Worksoft SaaS when execution completes/aborts using the GET method
- You can repeat the command with multiple header parameters
|
|
|