How do I access a DELETE service - REST
This example demonstrates accessing a DELETE method in the REST service.
In general, when you submit a DELETE request, Its primary purpose is to DELETE a resource identified by a URI.
In the solution shown below, service allows users to delete the project level template(s) for 'custom report(s)'. Users can delete the entire project level template or a work sheet within the template.
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/Worksoft SaaSDomainName /analytics/custom/template/config |
URL |
To set the HTTP request format |
|||
4 | wsSetRequestMethod |
DELETE |
|
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", "sheetNames": ["SHEET NAME <1>",.....,"SHEET NAME <N>"] } |
|
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 with multiple header parameters