本文へスキップ

サブスクリプションの管理

以下の API エンドポイントを使用して、購読を管理できます。

前提条件

  • OAuth2認証のためのユーザー認証情報、クライアントID、クライアントシークレットを送信します。Equinix APIへのリクエストを認証する方法については、「API認証」(../../equinix-api/api-authentication.md)を参照してください。

購読申し込み

すべてのストリーミング購読のリストを返すには、/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>'
このページは役に立ちましたか?