Add a WeCom User
Headers
Authorization: OAuth the-session-uuidBody
{
"params": {
"userId": "18099997777",
"endpointUuid": "3af92b4b14e83963b8565f194f302fce",
"remark": "jack"
},
"systemTags": [],
"userTags": []
}In the example above, the systemTags and userTags fields are optional. They are listed to indicate that these two fields can be included in the body.
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"userId":"18099997777","endpointUuid":"3af92b4b14e83963b8565f194f302fce","remark":"jack"}}' \
http://localhost:8080/zstack/v1/sns/application-endpoints/we-com/at-personsParameter List
| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| userId | String | body (contained in the params structure) | WeCom user ID | 4.2.0 | |
| endpointUuid | String | body (contained in the params structure) | WeCom endpoint UUID | 4.2.0 | |
| resourceUuid (optional) | String | body (contained in the params structure) | Resource UUID | 4.2.0 | |
| tagUuids (optional) | List | body (contained in the params structure) | Tag UUID list | 4.2.0 | |
| systemTags (optional) | List | body | System tags | 4.2.0 | |
| userTags (optional) | List | body | User tags | 4.2.0 | |
| remark (optional) | String | body (contained in the params structure) | Remark | 4.2.0 |
API Response
Response Example
{
"inventory": {
"uuid": "a3e851f0f2614e6ab11c8ad995cf9ea3",
"userId": "18988887777",
"endpointUuid": "2692f0b0ee1746c29f94a23730a1ed07",
"remark": "jack"
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | 4.2.0 | |
| error | ErrorCode | The error code. If not null, the operation failed. This field is null when the operation succeeds. For details, see error | 4.2.0 |
| inventory | SNSWeComAtPersonInventory | For details, see inventory | 4.2.0 |
error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | The error code number. A globally unique identifier for the error, for example, SYS.1000, HOST.1001. | 5.0.0 |
| description | String | A brief description of the error | 5.0.0 |
| details | String | Detailed information about the error | 5.0.0 |
| elaboration | String | Reserved field. Default is null. | 5.0.0 |
| opaque | LinkedHashMap | Reserved field. Default is null. | 5.0.0 |
| cause | ErrorCode | The root error. The source error that caused the current error. If there is no root error, this field is null. | 5.0.0 |
inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The UUID of the resource. Uniquely identifies the resource. | 4.2.0 |
| userId | String | WeCom user ID | 4.2.0 |
| endpointUuid | String | WeCom endpoint UUID | 4.2.0 |
SDK Examples
Java SDK
AddSNSWeComAtPersonAction action = new AddSNSWeComAtPersonAction();
action.userId = "18099997777";
action.endpointUuid = "3af92b4b14e83963b8565f194f302fce";
action.remark = "jack";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddSNSWeComAtPersonAction.Result res = action.call();Python SDK
AddSNSWeComAtPersonAction action = AddSNSWeComAtPersonAction()
action.userId = "18099997777"
action.endpointUuid = "3af92b4b14e83963b8565f194f302fce"
action.remark = "jack"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AddSNSWeComAtPersonAction.Result res = action.call()