> For the complete documentation index, see [llms.txt](https://doc.some3c.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.some3c.com/panda-classic/api-documentation.md).

# API Documentation

WebSocket API is a common and universal API interface of HTTP protocol, supporting various language calls, such as: key wizard, easy language, C++, Python, Html, Vue, Node.js and so on.

* Panda Classic WebSocket API address: ws\://127.0.0.1:33332
* WebSocket Online Test: <https://wstool.js.org/>

## 1.Obtain all device information

Request:

```json
{ "action":"list" }
```

Response:

```json
{
    "StatusCode": 200,
    "result": [
        {
            "deviceId": "ga7d65ylnj6xinhm",
            "name": "ga7d65ylnj6xinhm",
            "no": 1,
            "groupNames": ["group1", "group2"]
        },
        {
            "deviceId": "VBJDU18B14001987",
            "name": "VBJDU18B14001987",
            "no": 24,
            "groupNames": ["group1"]
        }
    ]
}
```

## 2.Screenshot

Request:

```json
{
    "action": "screen",
    "comm": {
        "deviceIds": "all",
        "savePath": "d:/quickmirror",
        "onlyDeviceName": 1,
        "customName": "test"
    }
}
```

* deviceIds: `"all"` means all devices, or devices can be specified by passing a comma-separated deviceId, for example `"ga7d65ylnj6xinhm, VBJDU18B14001987"`
* onlyDeviceName: Whether to directly use the device serial number as the screenshot file name
  * 1 means that the screenshot file name only has the device serial number (for example `ga7d65ylnj6xinhm.png` )
  * 0 indicates that the screenshot file name contains the device number and screenshot time (for example `1_ga7d65ylnj6xinhm_20240707_114500_096 .png` )
* customName: Specify the name used for the screenshot (no suffix is required), if this parameter is not empty, the name will be used as the screenshot name first, and customName can only be set when there is only one device in deviceIds
* Note: If it is a wireless connection, the `:` and `.` in the device serial number will be replaced by `_` (for example, the device `192.168.2.109:5555` screenshot file name is `1_192_168_2_109_5555_20240707_114919_656 .png` )

Response:

```json
{
    "StatusCode": 200,
    "result": "OK"
}
```

## 3.Screen control

Request:

```json
{
    "action": "PointerEvent",
    "comm": {
        "deviceIds": "all",
        "mask": "0",
        "x": "0.5",
        "y": "0.5",
        "endx": "0",
        "endy": "0",
        "delta": "0"
    }
}
```

* deviceIds: `"all"` means all devices, or devices can be specified by passing a comma-separated deviceId, for example `"ga7d65ylnj6xinhm, VBJDU18B14001987"`
* Mask: Event type: 0 press, 1 move, 2 release, 3 right mouse button (return), 4 scroll up, 5 scroll down, 6 slide up, 7 slide down, 8 slide left, 9 slide right
* X, y: event coordinates, pass percentage, range is 0-1
* Endx, endy: End coordinates. These two parameters are only needed for up, down, left, and right sliding events. Other events do not need to pass them
* Delta: The amplitude of the scroll wheel event, the range is an integer greater than 0, the larger the value, the greater the scroll wheel rolling amplitude, only the scroll wheel event needs this parameter, other events do not need to pass

Response:

```json
{
    "StatusCode": 200,
    "result": "OK"
}
```

Example:\
Swipe up screen

```json
//First, execute the command: mask=0, x=0.5, y=0.5, starting from the center.
{
    "action": "PointerEvent",
    "comm": {
        "deviceIds": "all",
        "mask": "0",
        "x": "0.5",
        "y": "0.5",
        "endx": "0",
        "endy": "0",
        "delta": "0"
    }
}
//Execute "move mask=1" to move to the 0.2 position. You can execute multiple "move" commands before releasing the button; doing so will result in dragging.  
{
    "action": "PointerEvent",
    "comm": {
        "deviceIds": "all",
        "mask": "1",
        "x": "0.5",
        "y": "0.2",
        "endx": "0",
        "endy": "0",
        "delta": "0"
    }
}
//Finally, release `mask=2 x y` and pass the final position.
{
    "action": "PointerEvent",
    "comm": {
        "deviceIds": "all",
        "mask": "2",
        "x": "0.5",
        "y": "0.2",
        "endx": "0",
        "endy": "0",
        "delta": "0"
    }
}
```

## 4.Get clipboard content

Request:

```json
{
    "action": "getclipboard",
    "comm": {
        "deviceIds": "8318fc66"
    }
}
```

* DeviceIds: This command does not support multiple phone deviceIds

Response:

```json
{
    "StatusCode": 200,
    "result": "Shear Plate Test"
}
```

## 5.Send to clipboard

Request:

```json
{
    "action": "writeclipboard",
    "comm": {
        "deviceIds": "all",
        "content": "Hi,panda"
    }
}
```

* deviceIds: `"all"` means all devices, or devices can be specified by passing a comma-separated deviceId, for example `"ga7d65ylnj6xinhm, VBJDU18B14001987"`

Response:

```json
{
    "StatusCode": 200,
    "result": "OK"
}
```

## 6.Execute ADB commands

Request:

```json
{
    "action": "adb",
    "comm": {
        "command": "am start -a android.intent.action.VIEW -d https://some3c.com",
        "deviceIds": "ga7d65ylnj6xinhm"
    }
}
```

* deviceIds: `"all"` means all devices, or devices can be specified by passing a comma-separated deviceId, for example `"ga7d65ylnj6xinhm, VBJDU18B14001987"`

Response:

```json
{
    "StatusCode": 200,
    "result": {
        "ga7d65ylnj6xinhm": [
            "Starting: Intent { act=android.intent.action.VIEW dat=https://some3c.com/... }"
        ]
    }
}
```

## 7.Execute ADB bat

Request：\
Execute custom bat：

```json
{
    "action": "ExecuteBat",
    "comm": {
        "deviceIds": "ga7d65ylnj6xinhm",
        "filePath" :"C:\\Scripts\\test.bat"
    }
}
```

* deviceIds: `"all"` means all devices, or devices can be specified by passing a comma-separated deviceId, for example `"ga7d65ylnj6xinhm, VBJDU18B14001987"`

Response：

```json
{
    "StatusCode": 200,
    "result": "OK"
}
```

## 8.Execute AutoX.js script

Request：\
Execute custom AutoX.js：

```json
{
    "action": "ExecuteAutoJs",
    "comm": {
        "deviceIds": "ga7d65ylnj6xinhm",
        "filePath" :"C:\\Scripts\\test.js"
    }
}
```

Stop custom AutoX.js：

```json
{
    "action": "StopAutoJs",
    "comm": {
        "deviceIds": "ga7d65ylnj6xinhm",
        "filePath" :"C:\\Scripts\\test.js"
    }
}
```

* deviceIds: `"all"` means all devices, or devices can be specified by passing a comma-separated deviceId, for example `"ga7d65ylnj6xinhm, VBJDU18B14001987"`

Response：

```json
{
    "StatusCode": 200,
    "result": "OK"
}
```
