# サブスクリプションの管理 以下の API エンドポイントを使用して、購読を管理できます。 ## 前提条件[​](#前提条件 "への直接リンク前提条件") * ユーザー認証情報、クライアントID、およびクライアントシークレットを送信してOauth2認証を行います。Equinix APIへのリクエストを認証する方法の詳細については、[API認証を](https://docs.equinix.com/ja/equinix-api/api-authentication.md)参照してください。 ## 購読申し込み[​](#購読申し込み "への直接リンク購読申し込み") すべてのストリーミングサブスクリプションのリストを返すには、エンドポイントにリクエストを[`/smartview/v2/streaming/subscriptions`](https://docs.equinix.com/ja/api-catalog/smartviewv2/streaming-subscription-api/getallsubscriptions.md)送信します。`GET` サンプルcURLリクエスト: ``` curl -X GET 'https://api.equinix.com/smartview/v2/streaming/subscriptions' -H 'authorization: Bearer ' ``` 回答例 ``` [ { "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}`](https://docs.equinix.com/ja/api-catalog/smartviewv2/streaming-subscription-api/getsubscriptionbyid.md)送信します。`GET` サンプルcURLリクエスト: ``` curl -X GET 'https://api.equinix.com/smartview/v2/streaming/subscriptions/606349eca6171829c70d8777' -H 'authorization: Bearer ' ``` 回答例 ``` { "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}`](https://docs.equinix.com/ja/api-catalog/smartviewv2/streaming-subscription-api/updatesubscription.md)送信します。`PUT`現在のサブスクリプション構成は、新しいリクエスト本文に置き換えられます。 サンプルcURLリクエスト: ``` curl -X PUT 'https://api.equinix.com/smartview/v2/streaming/subscriptions/{id}' -H 'authorization: Bearer ' -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}`](https://docs.equinix.com/ja/api-catalog/smartviewv2/streaming-subscription-api/deletesubscriptionbyid.md)送信します。`DELETE`削除リクエストを受信すると、サブスクリプションでイベントを利用できなくなります。 サンプルcURLリクエスト: ``` curl -X DELETE 'https://api.equinix.com/smartview/v2/streaming/subscriptions/606349eca6171829c70d8777' -H 'authorization: Bearer ' ```