# QR code operation elements

Get operation elements linked to a QR code by `coding` or full URL.

This endpoint returns a **flattened** array:

- Each item in `data` is one operation element
- If one operation contains multiple elements, they are returned as separate records
- If no operation is linked, `data` is `[]`

## Request example



```python [Python + requests]
import requests

url = "https://open.cli.im/api/v2/rpc/qrcodes/getOperation"
data = {
    "qrcode": "qk3mJHJ"
}
headers = {
    "Authorization": "Bearer <your API Key>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=data, headers=headers)
print(response.text)
```

```bash [curl]
curl -X POST 'https://open.cli.im/api/v2/rpc/qrcodes/getOperation' \
  -H 'Authorization: Bearer <your API Key>' \
  -H 'Content-Type: application/json' \
  -d '{"qrcode":"qk3mJHJ"}'
```



## Request parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `qrcode` | string | Yes | QR code `coding` or full URL, e.g. `qk3mJHJ` or `https://qr61.cn/xxxx/yyy` |

## Request body example

```json
{
  "qrcode": "qk3mJHJ"
}
```

## Full response example

```json
{
  "code": 0,
  "message": "ok",
  "data": [
    {
      "operation_name": "巡检操作",
      "operation_description": "每日巡检填写",
      "element_type": 2,
      "element_type_title": "填写表单",
      "element_value": 122507
    },
    {
      "operation_name": "巡检操作",
      "operation_description": "每日巡检填写",
      "element_type": 1,
      "element_type_title": "更新状态",
      "element_value": 88001
    }
  ]
}
```

In this example, one operation contains two elements:

- A form-fill element with `tpl_id = 122507`
- A state-update element with `state_id = 88001`

## Response overview

| Path | Type | Description |
| --- | --- | --- |
| `code` | integer | Platform status code, `0` for success |
| `message` | string | Status message (`ok` or empty string on success) |
| `data` | array | Flattened operation-element list |

### `data[]` fields

| Field | Type | Description |
| --- | --- | --- |
| `operation_name` | string | Operation title |
| `operation_description` | string | Subtitle/description (may be empty) |
| `element_type` | integer | Element type, see enum below |
| `element_type_title` | string | Element type title from server |
| `element_value` | integer\|string\|object | Associated value; meaning depends on `element_type` |

## `element_type` enum

| `element_type` | `element_type_title` | Meaning | `element_value` meaning |
| --- | --- | --- | --- |
| `1` | `更新状态` | Update QR code state option | State ID |
| `2` | `填写表单` | Fill or link to a form | Form template ID |
| `3` | `跳转链接` | Jump to external URL | Link config value |
| `4` | `更新子码内容` | Update subcode field content | Subcode field config |
| `5` | `更新子码内容` | Update related-code field content | Related-code field config |

Notes:

- `element_type_title` is display text returned by server.
- `element_type=4` and `5` may share title text but business semantics differ.
- For programmatic branching, use `element_type` rather than only `element_type_title`.

Integration tips:

- For `element_type=2`, `element_value` is `tpl_id`.
- After getting `tpl_id`, call [Get form template](https://cli.im/open-api/en/openapi/v2/api/record/forms-get-template.md) for field definitions and IDs.
- To read history, call [Get records](https://cli.im/open-api/en/openapi/v2/api/record/record-get-records.md).
- To submit new records, call [Add record](https://cli.im/open-api/en/openapi/v2/api/record/record-add-record.md).

## Empty result

```json
{
  "code": 0,
  "message": "ok",
  "data": []
}
```

## Error response

Typical non-success examples:

```json
{
  "code": 400,
  "error_code": 0,
  "message": "Invalid qrcode data, need coding or url"
}
```

```json
{
  "code": 400,
  "error_code": 0,
  "message": "Invalid qrcode url"
}
```

| Field | Type | Description |
| --- | --- | --- |
| `code` | integer | Error status, commonly `400` |
| `error_code` | integer | Business error code (varies by case) |
| `message` | string | Error summary |

Common error cases:

- Missing `qrcode`
- `qrcode` is not a valid QR code URL
- Target QR code does not exist

See [Error codes and rate limits](https://cli.im/open-api/en/openapi/v2/error-codes.md).
