跳至内容

创建订阅

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

注意

您的组织只能使用一种通信渠道类型。例如,如果您使用 AWS IoT Core 渠道创建订阅,则无法使用其他渠道类型创建另一个订阅。

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

先决条件

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

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

AWS IoT Core

要创建向 Amazon IoT Core 发送数据的订阅,请向 /smartview/v2/streaming/subscriptions 端点发送 POST 请求。在请求正文中,将 channelType 指定为 AWS_IOT_CORE,并在 awsIotCoreChannelConfiguration 中指定其 URL。在 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 发送数据的订阅,请向 /smartview/v2/streaming/subscriptions 端点发送 POST 请求。在请求正文中,将 channelType 指定为 WEBHOOK,并在 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 获取您的数据,请向 /smartview/v2/streaming/subscriptions 端点发送 POST 请求。在请求正文中,将 channelType 指定为 REST。在 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。

此页面有帮助吗?