This is the CopyCommander2 Rest API Documentation.
CopyCommander REST API only supports JSON as data format. To see how to enable / setup the REST functionality visit the rest api section in the how_to_use document.
There are 2 kinds of paths supported by CopyCommander2.
Normal paths are always available and can be used to get status, start jobs, ...
Zombie paths are used to control the application (visible to the user), to enable these paths you need to pass in a extra command line paramter.
| Method | Overview | Kind | Description |
|---|---|---|---|
| GET | /API/status | normal | get current state of application |
| GET | /API/view/list | normal | get list of content from a specific view |
| POST | /API/job | normal | start a job |
| POST | /API/shutdown | normal | shutdown CopyCommander2 |
| POST | /API/zombie/setdir | zombie | set directory path for left or right view |
Returns the current status of the application.
Method: GET
Path: /API/status
Content-Type: Not applicable
none
Content-Type: application/json
| Field | Type | Description |
|---|---|---|
State |
integer | Current application state (0 = idle, 1 = busy) |
JobQueueCount |
integer | Number of jobs currently in the queue |
LeftDir |
string | Path to the left directory |
RightDir |
string | Path to the right directory |
GET /API/status
{
"State": 0,
"JobQueueCount": 3,
"LeftDir": "C:\\Users\\john\\Documents\\Source",
"RightDir": "C:\\Users\\john\\Documents\\Backup"
}Returns the list of files and folders in the specified view.
Method: GET
Path: /API/view/list
Content-Type: Not applicable
| Parameter | Type | Required | Description |
|---|---|---|---|
view |
string | No | View to list ("left" or "right"). Defaults to "left" if not specified |
Content-Type: application/json
| Field | Type | Description |
|---|---|---|
dir |
string | Absolute path of the current directory |
folders |
array | Array of folder names in the view |
files |
array | Array of file names in the view |
GET /API/view/list?view=right
{
"folders": [
"Documents",
"Pictures",
"Videos"
],
"files": [
"readme.txt",
"config.json",
"backup.zip"
]
}Creates a new job to copy, move, or delete files/folders.
Method: POST
Path: /API/job
Content-Type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
operation |
string | Yes | Type of operation: "copy", "move", "delete" or "delete_empty_subfolders" |
source |
string | Yes | Source file or directory path |
target |
string | Conditional | Target directory path (required for "copy" and "move", ignored for "delete" or "delete_empty_subfolders") |
Copy operation:
{
"operation": "copy",
"source": "C:\\Users\\john\\Documents\\file.txt",
"target": "C:\\Users\\john\\Backup"
}Move operation:
{
"operation": "move",
"source": "C:\\Users\\john\\Documents\\folder",
"target": "C:\\Users\\john\\Archive"
}Delete operation:
{
"operation": "delete",
"source": "C:\\Users\\john\\Documents\\temp.txt"
}HTTP Status Codes:
201 Created- Job successfully created and queued400 Bad Request- Invalid operation type or missing required fields404 Not Found- Source file/directory does not exist422 Unprocessable Entity- Invalid paths or target directory does not exist
Content-Type: application/json
| Field | Type | Description |
|---|---|---|
status |
string | Current job status ("queued") |
{
"status": "queued"
}Shuts down the CopyCommander2 application.
Method: POST
Path: /API/shutdown
Content-Type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
skipJobs |
boolean | No | Whether to skip currently running jobs (default: false) |
{
"skipJobs": true
}HTTP Status Codes:
200 OK- Application shutdown initiated successfully403 Forbidden- Shutdown not allowed (jobs are running and skipJobs is false)
Sets the directory path for either the left or right view.
Method: POST
Path: /API/zombie/setdir
Content-Type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
view |
string | No | Must be either "left" or "right", default (left) |
dir |
string | Yes | Directory path to set |
{
"view": "left",
"dir": "C:\\Users\\john\\Documents\\NewSource"
}HTTP Status Codes:
204 No Content- Directory successfully set422 Unprocessable Entity- Invalid request data / target dir, does not exist.