
# 设备呼叫（API名称：openApiSendImMessage）
#### 功能介绍
用于与客户系统对接设备呼叫接口接口服务。
#### 相关API
| **接口名称**                                                             | **调用说明**                                                     |
|:---|:---|
| [获取Token](https://support.huaweicloud.com/api-isdp/api_01_0019.html) | 调用该接口获取到Token，再调用其他接口时，需要在请求消息头中添加"Authorization"，其值即为Token。 |
   
#### URL
| 请求方式 | HTTPS地址                                                                 | 服务架构    | 消息体类型            |
|:---|:---|:---|:---|
| POST | https://***isdp+域名***/openapi/v1/openSendImMessage/openApiSendImMessage | OpenAPI | application/json |
   
#### 请求头
| **KEY**       | VALUE                  | 是否必填 | **描述**                                                                                           |
|:---|:---|:---|:---|
| Content-Type  | application/json       | 是    | 无                                                                                                |
| Authorization | bearer ${access_token} | 是    | bearer +" "+[5.2.1](https://support.huaweicloud.com/api-isdp/api_01_0019.html)中获取的access_token的值 |
   
#### 请求参数
| 参数      | 类型     | 是否必填 | 描述                 |
|:---|:---|:---|:---|
| message | String | 是    | 根据需求有所变化，详情见下方请求示例 |
   
message参数说明
| 参数           | 类型     | 是否必填 | 描述                |
|:---|:---|:---|:---|
| userId       | long   | 是    | 应用管理中账号的userId    |
| userName     | String | 是    | 应用管理中账号的userName  |
| userNo       | String | 是    | 应用管理中账号的userNo    |
| tenantId     | int    | 是    | 租户id              |
| deviceId     | String | 是    | 接受设备的设备id         |
| isdpDeviceId | String | 是    | 接受设备的isdpDeviceId |
   
#### 响应参数
| 参数           | 类型     | 描述              |
|:---|:---|:---|
| result       | Object | 响应消息体           |
| errorMessage | String | 接口错误时有值，正常调用时为空 |
| stateCode    | String | "0"成功 其他值失败     |
   
#### 请求示例（呼叫设备例子）
注：标红部分的是账号需要修改，759646@saasgroupchat.xxxx.test.huawei.com为设备的chatJid；1663236474522是一个随机数UUID，http://xxxx.test.huawei.com仅为sit示例，具体地址视现场openfire服务而定，后续标红账号见上表说明（蓝色部分是发送指令）。
```
{"message":"<?xml version=\"1.0\" encoding=\"UTF-8\" ?><message to=\"759646@saasgroupchat.xxxx.test.huawei.com\" id=\"1663236474522\" type=\"chat\"><subject>qc-intellect-equip-remote-invite</subject><body>智能设备远端呼叫</body><properties xmlns=\"http://xxxx.test.huawei.com/xmlns/xmpp/properties\"><content_type type=\"string\">text</content_type><nick type=\"string\" /><directives_type type=\"string\">qc-intellect-equip-remote-invite</directives_type><directives_attrs type=\"string\">{&quot;userId&quot;:864711,&quot;userName&quot;:&quot;zhang_sit&quot;,&quot;userNo&quot;:&quot;Zhang123456&quot;,&quot;tenantId&quot;:886,&quot;deviceId&quot;:&quot;aqm0523&quot;,&quot;isdpDeviceId&quot;:&quot;aqm0523--1&quot;}</directives_attrs></properties></message>"}
```
#### 响应示例
```
{
    "stateCode": "0",
    "errorMessage": null,
    "result": null
}
```
#### 状态码
状态码请参见[状态码](https://support.huaweicloud.com/api-isdp/api_01_0326.html)。
#### 错误码
错误码请参见[错误码](https://support.huaweicloud.com/api-isdp/api_01_0327.html)。
