管理订阅
您可以使用以下 API 端点管理您的订阅。
先决条件
- 请提交您的用户凭据、客户端 ID 和客户端密钥以进行 OAuth2 身份验证。有关如何对 Equinix API 请求进行身份验证的更多信息,请参阅API 身份验证。
获取您的订阅
要返回所有流媒体订阅的列表,请向 /smartview/v2/streaming/subscriptions 端点发送 GET 请求。
示例 cURL 请求:
curl -X
GET 'https://api.equinix.com/smartview/v2/streaming/subscriptions'
-H 'authorization: Bearer <token>'
示例响应:
[
{
"id": "606349eca6171829c70d8777",
"status": "PENDING",
"messageType": {
"asset": [
{
"accountNumber": "135888",
"ibx": [
"DE2"
],
"assetClassification": [
"MECHANICAL"
],
"assetId": [
"string"
]
}
],
"environmental": [
{
"accountNumber": "135888",
"ibx": [
"DE2"
],
"level": [
"ZONE"
]
}
],
"power": [
{
"accountNumber": "135888",
"ibx": [
"DE2"
]
}
],
"meteredPower": [
{
"accountNumber": "135888",
"ibx": [
"DE2"
]
}
],
"systemAlert": [
{
"accountNumber": "135888",
"ibx": [
"DE2"
]
}
],
"customAlert": [
{
"accountNumber": "135888",
"ibx": [
"DE2"
],
"user": "abc"
}
]
},
"channel": {
"channelType": "AWS_IOT_CORE",
"awsIotCoreChannelConfiguration": {
"url": "https://b4c3mzxe8syvhd-ats.iot.us-west-2.amazonaws.com"
}
},
"orgId": "123",
"createdBy": "abc",
"createdDateTime": "2019-08-24T14:15:22Z",
"updatedBy": "abc",
"updatedDateTime": "2019-08-24T14:15:22Z"
}
]
获取订阅详情
要获取指定订阅的详细信息,请向 /smartview/v2/streaming/subscriptions/{id} 端点发送 GET 请求。
示例 cURL 请求:
curl -X
GET 'https://api.equinix.com/smartview/v2/streaming/subscriptions/606349eca6171829c70d8777'
-H 'authorization: Bearer <token>'
示例响应:
{
"id": "606349eca6171829c70d8777",
"status": "ACTIVE",
"messageType": {
"asset": [
{
"accountNumber": "135888",
"ibx": [
"DE2"
],
"assetClassification": [
"MECHANICAL"
],
"assetId": [
"string"
]
}
],
"environmental": [
{
"accountNumber": "135888",
"ibx": [
"DE2"
],
"level": [
"ZONE"
]
}
],
"power": [
{
"accountNumber": "135888",
"ibx": [
"DE2"
]
}
],
"meteredPower": [
{
"accountNumber": "135888",
"ibx": [
"DE2"
]
}
],
"systemAlert": [
{
"accountNumber": "135888",
"ibx": [
"DE2"
]
}
],
"customAlert": [
{
"accountNumber": "135888",
"ibx": [
"DE2"
],
"user": "abc"
}
]
},
"channel": {
"channelType": "AWS_IOT_CORE",
"awsIotCoreChannelConfiguration": {
"url": "https://b4c3mzxe8syvhd-ats.iot.us-west-2.amazonaws.com"
}
},
"orgId": "123",
"createdBy": "abc",
"createdDateTime": "2019-08-24T14:15:22Z",
"updatedBy": "abc",
"updatedDateTime": "2019-08-24T14:15:22Z"
}
更新订阅
要修改订阅,请向 /smartview/v2/streaming/subscriptions/{id} 端点发送 PUT 请求。新的请求体将替换当前的订阅配置。
示例 cURL 请求:
curl -X
PUT 'https://api.equinix.com/smartview/v2/streaming/subscriptions/{id}'
-H 'authorization: Bearer <token>'
-d '{
"messageType": {
"asset": [
{
"accountNumber": "135888",
"ibx": [
"DE2"
],
"assetClassification": [
"MECHANICAL"
],
"assetId": [
"string"
]
}
],
"environmental": [
{
"accountNumber": "135888",
"ibx": [
"DE2"
],
"level": [
"ZONE"
]
}
],
"power": [
{
"accountNumber": "135888",
"ibx": [
"DE2"
]
}
],
"meteredPower": [
{
"accountNumber": "135888",
"ibx": [
"DE2"
]
}
],
"systemAlert": [
{
"accountNumber": "135888",
"ibx": [
"DE2"
]
}
],
"customAlert": [
{
"accountNumber": "135888",
"ibx": [
"DE2"
],
"user": "abc"
}
]
},
"channel": {
"channelType": "AWS_IOT_CORE",
"awsIotCoreChannelConfiguration": {
"url": "https://b4c3mzxe8syvhd-ats.iot.us-west-2.amazonaws.com"
}
}
}'
删除一个订阅
要删除订阅,请向 /smartview/v2/streaming/subscriptions/{id} 端点发送 DELETE 请求。收到删除请求后,该订阅的事件将不再可用。
示例 cURL 请求:
curl -X
DELETE 'https://api.equinix.com/smartview/v2/streaming/subscriptions/606349eca6171829c70d8777'
-H 'authorization: Bearer <token>'