Skip to content

How do I access a PUT service using REST

This example demonstrates accessing a PUT service in the REST

In general, when you submit a PUT request, Its primary purpose is to send data to a server that we want to create or update.

In the solution shown below, the service allows users to bulk assign the root cause for failure label to one or more failed test runs within a specific test cycle.

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/labels/assign
URL
To set the HTTP request format
4 wsSetRequestMethod
PUT

To set the authentication type - Basic
5 wsAuthenticationType Basic
To set the Username to login to Worksoft SaaS Domain
6 wsSetUsername
your user name
To Set the Password to login to Worksoft SaaS Domain
7 wsSetPassword your password
To set the request body format and output type
8 wsSetRequestHeaderParam Content-Type
application/json
To set the request body format and output type
9 wsSetRequestPayload {
  "projectName": "YOUR_PROJECT_NAME",
  "testCycleIdentifier": "YOUR_TEST_CYCLE_IDENTIFIER",
    "list": [{
        "rootCauseListForRunIds": {
            "Root Cause for Failure": ["CHILD_LABEL1","CHILD_LABEL2"]
        },
        "runIds": ["7XXTXX-4XXXXX","7XUXXX-6XXXXX"]
    }]
}
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 repeat the command "wsSetRequestHeaderParam" with multiple header parameters.

Feedback and Knowledge Base