REST API - Test Environment
If you have access to the Web Console, a “sandbox” environment is available by adding /sandbox to the end of the Web Console URL, for example: http://client.mydomain.com/webconsole/sandbox. For information on installing the Web Console, see Installing the Command Center.
Features of the Test Environment
- After the POST Login API retrieves the authentication token, the test environment automatically includes the token in all requests made to the server.
- The request body is built once an API is selected, so you can see the proper syntax, parameters, and headers for the selected API.
- Both XML and JSON responses are supported.
Using the Test Environment
You can use the test environment to run Commvault Systems, Inc. APIs. The following example a backup is performed.
Request an Authentication Token
- From the Webservice APIs panel, click Login to build the request body for the POST Login API.
The login request includes the following element and parameters:
<DM2ContentIndexing_CheckCredentialReq username="" password="" />
- From the Variables/Request Parameters panel, enter the Username and Password parameters.
- Click Invoke.
If the request is successful, the response body will contain an authentication token:
<DM2ContentIndexing_CheckCredentialResp aliasName="1" userGUID="878D6149-65F9-424B-80DF-92FC1B0BF2D1" token="QSDK 3da0fc26b01516c7b0eceefe8b57362f49dd2b0a48f412f8119898ac6a69fb37217fce44c9a467
e0fba917710b781fc7a0751a4c33483f838eaab110dc6d94617de7c841f4158a41a02e4d464825
ea8e2322c16f4211d9cc13d1811df49bc966bafd8922791af40d4250d2b0495483e302ffe0dd53
f13e424b4292bfd37649dac29ef65f3bd7bb47c81da68830c3c9ca2a72e9649e602cac02fb4ab7
466ed17fc6fbc053b71b6b0245e6c109example59ab1291cc3905fa6e211cd028088c0d1fcbee
7a772c8035149530f4859c74477abfc7d3562ae2b715cb59e6104b3542f0b28d4d3194bb43aef6
51bc0f8399ecec0a6bbd7a7dfd26b7cc3521a59f4b503ccd538bfbd17eexample486acc3e6aa3" ccn="0" userName="admin" />
Use a Set of APIs to Perform a Backup
In this sample flow, a set of APIs is used to back up a default backup set.
- From the Webservice APIs panel, click Client to build the request body for the GET Client API.
- Click Invoke.
The response body contains all of the clients in the CommCell Console. Each client is separated by the <clientProperties> element.
- In the response body, find the clientId attribute for a client with a file system agent. The client ID is the parameter for the next API.
- From the Webservice APIs panel, click Backupset to build the request body for the GET Backup Set API.
- From the Variables/Request Parameters panel, enter the Client Machine ID parameter. Use the value from the GET Client clientId attribute.
- Click Invoke.
The response body contains all of the backup sets for the client. Each backup set is separated by the <backupsetProperties> element.
- In the response body, find the backupsetID attribute for the file system default backup set. The backup set ID is the parameter for the next API.
Inside the <backupsetProperties> element, the appName and backupsetName attributes identify the backup set: appName="Windows File System" backupsetName="defaultBackupSet".
- From the Webservice APIs panel, click {backupsetId}, and then click action to build the request body for the POST Backup Set Backup API.
- From the Variables/Request Parameters panel, enter the Backup Set ID parameter. Use the value from the GET Backup Set backupsetID attribute.
- Click Invoke to start the backup job.
The response body lists all of the backup jobs running for the backup set. A job ID is created for each subclient in the backup set. Each job ID is in the val attribute in the <jobIds> element: <jobIds val="972"/>.
- In the response body, find the val attribute for one of the backup jobs. The job ID in the val attribute is the parameter for the next API.
- From the Webservice APIs panel, click Job, and then click {jobID} to build the request body for the GET Job Properties API.
- From the Variables/Request Parameters panel, enter the Job ID parameter. Use the value from the POST Backup Set Backup val attribute.
- Click Invoke.
The response body contains details about the backup job. For example, the status and the subclientName attributes are available in the <jobSummary> element.
Log Off
- From the Webservice APIs panel, click Logout to build the request body for the POST Logout API.
- Click Invoke.
After you log off, your authentication token is no longer valid. Use the POST Login API to retrieve a new token.
Last modified: 8/27/2018 6:45:39 PM