Get Event¶
通过 eventId 获取事件的详细信息。
操作权限¶
需授权的资源  | 
所需操作权限  | 
|---|---|
资产  | 
Control  | 
请求格式¶
GET https://{apigw-address}/connect-service/v2.1/events?action=get
请求参数(URI)¶
名称  | 
位置(Path/Query)  | 
必需/可选  | 
数据类型  | 
描述  | 
|---|---|---|---|---|
orgId  | 
Query  | 
必需  | 
String  | 
资产所属的组织ID。 如何获取orgId信息>>  | 
eventId  | 
Query  | 
必需  | 
String  | 
事件标识符。  | 
响应参数¶
名称  | 
数据类型  | 
描述  | 
|---|---|---|
data  | 
Event结构体  | 
Event的具体信息,见 Event结构体>>  | 
Event结构体¶
名称  | 
数据类型  | 
描述  | 
|---|---|---|
orgId  | 
String  | 
资产所属的组织ID。  | 
eventId  | 
String  | 
事件ID。  | 
productKey  | 
String  | 
Product Key.  | 
deviceKey  | 
String  | 
Device Key.  | 
assetId  | 
String  | 
资产ID。  | 
tslEventKey  | 
String  | 
TSL模型中的事件Key。  | 
tslEventType  | 
String  | 
TSL模型中定义的事件类型。  | 
output  | 
String  | 
事件的输出。  | 
timestamp  | 
Long  | 
事件发生时间戳。  | 
localtime  | 
String  | 
事件发生本地时间。  | 
示例¶
请求示例¶
url: https://{apigw-address}/connect-service/v2.1/events?action=get&eventId=yourEventId&orgId=yourOrgId
method: GET
返回示例¶
{
    "code":0,
    "msg":"OK",
    "requestId":"0c45090a-f7c0-476c-8d47-33947d7a57f6",
    "data":{
        "eventId":"20190506587247156ca85be5e3422d30e2642dd1",
        "orgId":"yourOrgId",
        "productKey":"yourProductKey",
        "deviceKey":"yourDeviceKey",
        "assetId":"yourAssetId",
        "tslEventKey":"yourEventKey",
        "tslEventType":"INFO",
        "output":"{\"float\":116}",
        "timestamp":1557113821000,
        "localtime":"2019-05-06 11:37:01"
    }
}
Java SDK调用示例¶
package com.envisioniot.enos.api.sample.connect_service.event;
import com.envision.apim.poseidon.config.PConfig;
import com.envision.apim.poseidon.core.Poseidon;
import com.envisioniot.enos.connect_service.v2_1.event.GetEventRequest;
import com.envisioniot.enos.connect_service.v2_1.event.GetEventResponse;
import com.google.gson.Gson;
public class GetEvent {
    public static void main(String[] args) {
        String appKey = "yourAppKey";
        String appSecret = "yourAppSecret";
        GetEventRequest request = new GetEventRequest();
        request.setOrgId("yourOrgId");
        request.setEventId("yourEventId");
        try {
            GetEventResponse response = Poseidon.config(PConfig.init().appKey(appKey).appSecret(appSecret).debug())
                .url("yourServerUrl")
                .getResponse(request, GetEventResponse.class);
            Gson gson = new Gson();
            System.out.println(gson.toJson(response));
        } catch (Exception e) {
            System.out.print(e);
        }
    }
}