# User related

## 1.Log in

### Calling  <a href="#diao-yong-shuo-ming" id="diao-yong-shuo-ming"></a>

* **Request Parameters**

| parameter | type    | illustrate         | Remark                |
| --------- | ------- | ------------------ | --------------------- |
| fun       | String  | /config/user/login | Request function name |
| phone     | String  | Phone number       | -                     |
| password  | String  | password           | -                     |
| utag      | Integer | Sub-account        | 1-10                  |

* **httpGet request example**

```
curl --request GET \
  --url 'http://192.168.9.9:9911/api/config/user/login?phone=13999999999&password=sdfsdfsdf&utag=2'
```

* **httpPost request example**

```
curl --request POST \
  --url http://192.168.9.9:9911/api \
  --header 'content-type: multipart/form-data' \
  --form fun=/config/user/login \
  --form phone=13999999999 \
  --form password=sdfdfdsf \
  --form utag=2 
```

* **httpPost json request example \[websocket can also send the same json request]**

```
curl --request POST \
  --url http://192.168.9.9:9911/api \
  --header 'Content-Type: application/json' \
  --data '{
    "fun": "/config/user/login",
    "data": {
        "phone":"13999999999",
        "password":"sdfsdfdsf",
        "utag":2
    }
}'
```

### Response  <a href="#xiang-ying-jie-guo" id="xiang-ying-jie-guo"></a>

```
{
  "data": {
    "code": 0,
    "id": "",
    "pass": true,
    "total_license": 0,
    "local_total_license": 100,
    "dev_num": 16,
    "dev_online_num": 0,
    "create_time": 1690800970000,
    "overdue_time": 1683288910000,
    "phone": "13999999999",
    "utag": 2,
    "info_clock_in_time": 60000,
    "add_clock_in_time": 60000,
    "info_time": 885192828,
    "add_time": 0,
    "utag_data": "",
    "test_num": 100,
    "user_state": 2,
    "network_time": 1735124455463,
    "message": "成功"
  },
  "status": 200,
  "message": "成功",
  "msgid": 0,
  "fun": "/config/user/login"
}
```

* **Response data field description**

| Fields                | illustrate                                       | Remark |
| --------------------- | ------------------------------------------------ | ------ |
| total\_license        | Number of authorizations                         | -      |
| local\_total\_license | Test authorization number                        | -      |
| create\_time          | Registration Time                                | -      |
| overdue\_time         | Expiration time                                  | -      |
| user\_state           | 1 Formal authorization, other test authorization | -      |
| pass                  | Verification passed                              | -      |
| dev\_num              | Number of users                                  | -      |
| dev\_online\_num      | Online                                           | -      |
| dev\_num              | Verification passed                              | -      |
| utag                  | Sub-account                                      | -      |

## 2.Log out

### Calling  <a href="#diao-yong-shuo-ming" id="diao-yong-shuo-ming"></a>

* **Request Parameters**

| parameter | type   | illustrate          | Remark                |
| --------- | ------ | ------------------- | --------------------- |
| fun       | String | /config/user/logout | Request function name |

* **httpGet request example**

```
curl --request GET \
  --url 'http://192.168.9.9:9911/api/config/user/logout'
```

* **httpPost request example**

```
curl --request POST \
  --url http://192.168.9.9:9911/api \
  --header 'content-type: multipart/form-data' \
  --form fun=/config/user/logout
```

* **httpPost json request example \[websocket can also send the same json request]**

```
curl --request POST \
  --url http://192.168.9.9:9911/api \
  --header 'Content-Type: application/json' \
  --data '{
    "fun": "/config/user/logout",
    "data": {
    }
}'
```

### Response  <a href="#xiang-ying-jie-guo" id="xiang-ying-jie-guo"></a>

```
    {
  "data": {
    "code": 0,
    "id": "90:81:58:EE:D1:9E",
    "message": "成功"
  },
  "status": 200,
  "message": "成功",
  "msgid": 0,
  "fun": "/config/user/logout"
}
```

* **Response data data field description**\
  None

## 3.Get user information

### Calling  <a href="#diao-yong-shuo-ming" id="diao-yong-shuo-ming"></a>

* **Request Parameters**

| parameter | type   | illustrate        | Remark                |
| --------- | ------ | ----------------- | --------------------- |
| fun       | String | /config/user/info | Request function name |

* **httpGet request example**

```
curl --request GET \
  --url 'http://192.168.9.9:9911/api/config/user/info'
```

* **httpPost request example**

```
curl --request POST \
  --url http://192.168.9.9:9911/api \
  --header 'content-type: multipart/form-data' \
  --form fun=/config/user/info
```

* **httpPost json request example \[websocket can also send the same json request]**

```
curl --request POST \
  --url http://192.168.9.9:9911/api \
  --header 'Content-Type: application/json' \
  --data '{
    "fun": "/config/user/info",
    "data": {
    }
}'
```

### Response  <a href="#xiang-ying-jie-guo" id="xiang-ying-jie-guo"></a>

```
{
  "data": {
    "code": 0,
    "id": "",
    "pass": true,
    "total_license": 0,
    "local_total_license": 100,
    "dev_num": 16,
    "dev_online_num": 0,
    "create_time": 1690800970000,
    "overdue_time": 1683288910000,
    "phone": "13999999999",
    "utag": 2,
    "info_clock_in_time": 60000,
    "add_clock_in_time": 60000,
    "info_time": 885192828,
    "add_time": 0,
    "utag_data": "",
    "test_num": 100,
    "user_state": 2,
    "network_time": 1735124455463,
    "message": "成功"
  },
  "status": 200,
  "message": "成功",
  "msgid": 0,
  "fun": "/config/user/info"
}
```

* **Response data field description**

| Fields                | illustrate                                       | Remark |
| --------------------- | ------------------------------------------------ | ------ |
| total\_license        | Number of authorizations                         | -      |
| local\_total\_license | Test authorization number                        | -      |
| create\_time          | Registration Time                                | -      |
| overdue\_time         | Expiration time                                  | -      |
| user\_state           | 1 Formal authorization, other test authorization | -      |
| pass                  | Verification passed                              | -      |
| dev\_num              | Number of users                                  | -      |
| dev\_online\_num      | Online                                           | -      |
| dev\_num              | Verification passed                              | -      |
| utag                  | Sub-account                                      | -      |

## 4.Switch sub-account

### Calling  <a href="#diao-yong-shuo-ming" id="diao-yong-shuo-ming"></a>

* **Request Parameters**

| parameter | type   | illustrate          | Remark                |
| --------- | ------ | ------------------- | --------------------- |
| fun       | String | /config/user/switch | Request function name |
| id        | String | 1 to 10             |                       |

* **httpGet request example**

```
curl --request GET \
  --url 'http://192.168.9.9:9911/api/config/user/switch?id=1'
```

* **httpPost request example**

```
curl --request POST \
  --url http://192.168.9.9:9911/api \
  --header 'content-type: multipart/form-data' \
  --form fun=/config/user/switch \
  --form id=2
```

* **httpPost json request example \[websocket can also send the same json request]**

```
curl --request POST \
  --url http://192.168.9.9:9911/api \
  --header 'Content-Type: application/json' \
  --data '{
    "fun": "/config/user/switch",
    "data": {
      "id":"3"
    }
}'
```

### Response  <a href="#xiang-ying-jie-guo" id="xiang-ying-jie-guo"></a>

```
{
  "data": {
    "code": 0,
    "id": "2",
    "message": "成功"
  },
  "status": 200,
  "message": "成功",
  "msgid": 0,
  "fun": "/config/user/switch"
}
```

* **Response data field description**

| Fields | illustrate    | Remark |
| ------ | ------------- | ------ |
| id     | Subaccount id | -      |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.some3c.com/iphone-farm-setup/xp-api-documentation/user-related.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
