跳转到主要内容

创建订阅

设置并配置数据收集器后,创建订阅以将您的主机托管数据传输到该数据收集器。

注意

您只能在组织中使用一种通信信道类型。例如,如果您使用AWS物联网核心信道创建订阅,您将无法使用其他信道类型创建另一个订阅。

单个订阅仅允许一个频道。

先决条件

  • 调用订阅管理API之前,请参阅与收集器集成以设置和配置数据的目标。

  • 提交您的用户凭据,客户端ID和客户端机密以进行OAuth2身份验证。有关如何验证对Equinix API的请求的详细信息,请参阅API身份验证。

AWS IoT Core

要创建订阅以将数据发送至Amazon IoT Core,请向端点发送POST请求/smartview/v2/streaming/subscriptions。在请求正文中,在中指定channelTypeASAWS_IOT_CORE及其URLawsIotCoreChannelConfiguration。 指定对象中应接收的数据messageType

cURL 请求示例:

curl -X 
POST 'https://api.equinix.com/smartview/v2/streaming/subscriptions'
-H 'content-type: application/json'
-H 'authorization: Bearer <token>'
-d '{
    "messageType": {
        "asset": [],
        "environmental": [
            {
                "accountNumber": "116710",
                "ibx": [
                    "LD9"
                ],
                "level": [
                    "CAGE"
                ]
            }
        ],
        "power": [],
        "meteredPower": [],
        "systemAlert": [],
        "customAlert": []
    },
    "channel": {
        "channelType": "AWS_IOT_CORE",
        "awsIotCoreChannelConfiguration": {
            "url": "https://<awsIotCoreuri>.amazonaws.com"
        }
    }
}' 

有关的可用选项的完整列表messageType,请参阅API参考

Azure 事件中心

要创建Azure频道订阅, 请联系支持部门

Webhook

要创建订阅以将数据发送到webhook,请向端点发送POST请求/smartview/v2/streaming/subscriptions。在请求正文中,在中指定channelTypeASWEBHOOK及其配置webhookChannelConfiguration。 指定对象中应接收的数据messageType

cURL 请求示例:

curl -X 
POST 'https://api.equinix.com/smartview/v2/streaming/subscriptions'
-H 'content-type: application/json'
-H 'authorization: Bearer <token>'
-d '{
    "messageType": {
        "asset": [],
        "environmental": [
            {
                "accountNumber": "116710",
                "ibx": [
                    "LD9"
                ],
                "level": [
                    "CAGE"
                ]
            }
        ],
        "power": [],
        "meteredPower": [],
        "systemAlert": [],
        "customAlert": []
    },
    "channel": {
        "channelType": "WEBHOOK",
        "webhookChannelConfiguration": {
"sslCertificate": "ZkFzZLY1IGRpY31kZXI=...",
"url": "https://<webhook-uri>.com",
"numberOfRetries": 1,
"numberOfConcurrentCalls": 20,
"batchSize": 5
},
    }
}' 

有关webhook配置选项和可用选项的列表messageType,请参阅API参考手册

Equinix REST API

要创建订阅以使您的数据从Equinix API可用,请向终结点发送POST请求/smartview/v2/streaming/subscriptions。在请求正文中,指定channelTypeREST。 指定对象中应接收的数据messageType

cURL 请求示例:

curl -X 
POST 'https://api.equinix.com/smartview/v2/streaming/subscriptions'
-H 'content-type: application/json'
-H 'authorization: Bearer <token>'
-d '{
    "messageType": {
        "asset": [],
        "environmental": [
            {
                "accountNumber": "116710",
                "ibx": [
                    "LD9"
                ],
                "level": [
                    "CAGE"
                ]
            }
        ],
        "power": [],
        "meteredPower": [],
        "systemAlert": [],
        "customAlert": []
    },
    channel": {
"channelType": "REST",
"restChannelConfiguration": {
}
}
}' 

有关的可用选项的完整列表messageType,请参阅API参考

示例回答:

HTTP/1.1 201 Created
Location: /smartview/v2/streaming/subscriptions/0f6bdb36-e130-4924-b038-ee1785fad999

Location响应中的标题包含使用实时源所需的订阅ID。

这个页面对您有帮助吗?