Example 2: Select Statistics for a Process using REST API
Workflow
The following example describes steps to execute a Select Statistics Services RESTful API using GET method.
- Call the SignOn API and get the authorization token and XSRF-TOKEN token from the header
in the response.
Authorization: eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJBZG1pbmlzdHJhdG9yOjE3Mi4yMC4xODYuMzU6MTM2MzplMD I0YjAzZC03NzkwLTQxMjItOTZkOC1iZjg5MmY5NDcxM2MiLCJleHAiOjE1NTcxMjcyMTJ9.ME_mni- wgmrzVL214ijhxNzU-bgHw9bv-Ktz8WL84ljpEYtgm89jfH7ehspyk-zgS6J8JiL2GJrG3JYo1REs1w XSRF: 809ab7e8-c6be-41ac-84f1-b4f8db246d9e
- Submit a GET request at the following URL with process number generated in Example 1: Submit a Process using REST API:
https://<CDWS_IPAddress:Port>/cdwebconsole/svc/selectstatistics? processNumber= 126
- Call the API with the Authorization header:
Authorization: <Authorization _Token_From_Step_1>
- Call the API with the XSRF header as X-XSRF-TOKEN:
X-XSRF-TOKEN : <XSRF_Token_From_Step_1>
- Set the content type to:
Content-Type: application/json; charset=utf-8
- Complete the request body as follows:
Get /cdwebconsole/svc/selectstatistics?processNumber=126 HTTP/1.1 Host: <CDWS_IPAddress:Port> Content-Type: application/json X-XSRF-TOKEN: 809ab7e8-c6be-41ac-84f1-b4f8db246d9e Authorization: eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJBZG1pbmlzdHJhdG9yOjE3Mi4yMC4 xODYuMzU6MTM2MzplMDI0YjAzZC03NzkwLTQxMjItOTZkOC1iZjg5MmY5NDcxM2MiLCJleHAiOj E1NTcxMjcyMTJ9.ME_mni-wgmrzVL214ijhxNzU-bgHw9bv-Ktz8WL84ljpEYtgm89jfH7ehspyk -zgS6J8JiL2GJrG3JYo1REs1w Cache-Control: no-cache
- Response received as follows:
{ "stopTime": "Mon May 06 12:41:32 IST 2019", "submitNode": "CDWLT-025", "msgShortText": "The submit of the process succeeded.", "recordCategory": "CAPR", "startTime": "Mon May 06 12:41:32 IST 2019", "recordId": "SUBP", "conditionCode": 0, "submitter": "Administrator", "messageId": "LCCA013I", "logDateTime": "Mon May 06 12:41:32 IST 2019", "processName": "PP", "processNumber": 127, "secondaryNode": "CDWLT-025" }