Who is this article for?
CrashPlan for Enterprise, no.
Code42 for Enterprise, yes.
CrashPlan for Small Business, yes.
This article applies to on-premises authority server version 4.
Note: This server version is no longer supported.
Administrators of any storage environment must be prepared to manage storage space. Use the
planSummary resource in the Code42 API to help you manage storage by identifying the largest plans in your Code42 environment. This article shows you how to use the Code42 API to find out which plans are the largest, and then use the Code42 console to take a closer look at those plans and take appropriate action.
Before you begin
- If you are new to the Code42 API, read our introduction to using the Code42 API.
- Test your script or solution in a staging environment or organization before deploying it for production use.
- Confirm that you can access the Code42 API Documentation Viewer in order to reference the built-in API documentation.
- You can also get information on the storage space utilized by plans from the Code42 console, although the method used in this article provides more information, as well as data that can be downloaded in JSON or CSV format.
- The code examples use the Linux command-line utility curl utility, but these examples are applicable to any operating system and tool.
- The example script used in this article is for demonstration purposes only. You can use it as the basis for your own solution, but your solution must be customized for your environment.
- For assistance with creating your own custom script, contact your PRO Services representative.
Step 1: Gather necessary information
You will need the following information in order to use the Code42 API successfully:
- The username and password of a user with the necessary role or privileges.
- The fully qualified domain name (FQDN), hostname, or IP address of the master server
Step 2: Use the Code42 API with web browser
Once you have the necessary information needed to connect to your master server with the necessary privileges, it's time to connect to your Code42 environment with the Code42 API in order to test your credentials and hostname/port information.
The easiest method of testing the Code42 API is to simply use your web browser to submit a query and view the results.
The following URL with query parameters will use the Code42 API to query your master server and retrieve information on the plans that are stored in your Code42 environment. The plans will be sorted by the total size of the storage space being used by each plan, and the data will be in JSON format. See the entry for the
planSummary resource in the API Documentation Viewer for a complete listing of the available methods, query parameters, and output values.
- Enter the following URL with query parameters into your web browser's address field, replacing
master-server.example.comwith your master server's FQDN, hostname, or IP address:
- Your browser should ask you to enter credentials. Enter your username and password:
- The browser will display the results returned by the Code42 API in JSON format:
- (Optional) Consider installing a browser extension or plug-in that formats JSON data to make it easier to read. For example:
Step 3: Create script or curl command and save results
Although you may find the data you need by simply using a web browser as detailed above, you may wish to save the results of your queries for further analysis. For example, you could save the results in CSV format and then view the results in a spreadsheet.
In order to save the data, use a command-line tool such as curl to connect to your Code42 environment with the Code42 API, instead of using a web browser.
The following command will gather the same information as the method using the web browser above, but this command saves the data to a file named results.json:
curl -k -u 'username:password' "https://master-server.example.com:4285/api/planSummary?srtKey=totalArchiveBytes&srtDir=desc" > results.json
If you would prefer to save the results in CSV format, use the following curl command, which includes an additional query parameter,
curl -k -u 'username:password' "https://master-server.example.com:4285/api/planSummary?srtKey=totalArchiveBytes&srtDir=desc&export='csv'" > results.csv
Step 4: Customize the command based on your needs
Most resources in the Code42 API provide numerous options that allow you to fine-tune the results based on your need for specific information. The
planSummary resource is no exception. The table below displays some of the query parameters and options that are available:
|Example Parameter||API Documentation||Description|
| ||key to sort on|| |
Sorts the results of the
| ||direction of sort||Sorts results in ascending or descending order.|
| ||the max number of objects to return||Specifies a maximum number of results.|
| || ||Allows the request to respond with only active or deactivated plans. If this query parameter is not included, both active and inactive plans are returned.|
| ||option to specify an export||Instructs the |
For more information on the detailed options available for the
planSummary resource, refer to the API Documentation Viewer.