The CrashPlan Web Services Interface lets you manipulate a set of resources using a collection of web services built on REST design principles.
One of the way-cool aspects of this type of API is that you can use your browser to download or view the data before you write a script to do it. For example, try this right now with your browser (You will have to enter an admin username and password):
http://<your.proserver.ip.address>:4280/rest/users?status=Active (downloads all active users)
Sample python scripts are below. If you write a script accessing our API to do something unique, feel free to post an example to our PRO forum to help others to write scripts.
You can manipulate resources using a set of actions. These actions include most of the standard create, read, update and delete operations as well as a list operation, which supports retrieving all instances of a particular resource. You can constrain this list so that only resources matching specific criteria are returned. For example, a list of all orgs may be constrained to show only those orgs with the name 'Test'.
The framework supports this full set of actions:
Note that not all actions are supported for all resources; details can be found below.
An incoming HTTP request corresponds to the application of exactly one action on exactly one resource. The only exception is the list action which operates on an entire class of resources, but even in this case a single request corresponds to a single action. HTTP requests are mapped onto actions using a combination of the HTTP method and the URI:
| HTTP method | URI | Action | Request body | Response body |
|---|---|---|---|---|
| GET | http://localhost:4280/rest/orgs/234 | Retrieve org with ID of 234 | None | Detailed information about org with ID of 234 |
| GET | http://localhost:4280/rest/orgs | List all orgs | None | List of all orgs |
| POST | http://localhost:4280/rest/orgs | Create a new org | Values to use when creating the new org | Detailed information about new org; identical to a retrieve operation |
| PUT | http://localhost:4280/rest/orgs/234 | Update org 234 | Values to use when updating org 234 | Detailed information about updated org; identical to a retrieve operation |
As mentioned above, a list operation is constrained to return only resources that match one or more criteria. You can include these constraints as query parameters of the GET request, if desired. For example, changing the sample URL above to http://localhost:4280/rest/org?name=Test returns only orgs with the name “Test”.
Note that not all methods are available for all resources. If a particular resource receives a request using an HTTP method that it does not support, an HTTP type 405 error is returned. The response also includes an “Allow” header that indicates which methods are acceptable for the specified resource.
CrashPlan Web services support sending and receiving data in both XML and JSON formats. There are two headers associated with data format: Accept and Content-Type. The Accept header controls the response format. The Content-Type header tells the server what type of content the client is sending and is required when content is provided.
This header identifies the type of the content contained in an incoming HTTP request. Use of this header is required for requests that contain content, such as a PUT or POST request. The server returns an HTTP type 415 error if a request includes content but excludes the Content-Type header or if the value of the header is not a supported type.
The client specifies a response type with the Accept header. If client does not provide the Accept header, the server assumes a response type of JSON. The server returns an HTTP type 406 error if it cannot create a response of the type identified in the header.
Identify types by including a MIME type in one or both of the headers discussed above. The following types (and their corresponding MIME types) are available:
| Type | Supported MIME type(s) | Note |
|---|---|---|
| XML | text/xml,application/xml | Verbose. Most scripting languages support XML. |
| JSON | application/json | Low bandwidth. |
| PLAINTEXT | text/plain | Only supported for a few resources. |
Date information is always returned as a string value containing the ISO 8601 representation of the underlying date.
All resources contain at least three properties: