サブスクリプションの作成
データコレクターのセットアップと構成が完了したら、コロケーションデータをデータコレクターにストリーミングするためのサブスクリプションを作成します。
組織で使用できる通信チャネルタイプは1つのみです。たとえば、AWS IoTコアチャネルでサブスクリプションを作成する場合、別のチャネルタイプを使用して別のサブスクリプションを作成することはできません。
1つのサブスクリプションで使用できるチャンネルは1つのみです。
前提条件
-
サブスクリプション管理APIを呼び出す前に、「コレクタとの統合」を参照して、データの宛先を設定および構成してください。
-
ユーザー認証情報、クライアントID、およびクライアントシークレットを送信してOauth2認証を行います。Equinix APIへのリクエストを認証する方法の詳細については、API認証を参照してください。
AWS IoTコア
Amazon IoT Coreにデータを送信するサブスクリプションを作成するには、エンドポイントにリクエストを/smartview/v2/streaming/subscriptions送信します。POSTリクエストの本文で、ASAWS_IOT_COREとそのURLをで指定します。channelType``awsIotCoreChannelConfiguration オブジェクトで受信するデータを指定します。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"
}
}
}'
で使用可能なオプションの完全なリストについては、APIリファレンスをmessageType参照してください。
ウェブフック
Webhookにデータを送信するサブスクリプションを作成するには、エンドポイントにリクエストを/smartview/v2/streaming/subscriptions送信します。POSTリクエストの本文で、ASWEBHOOKとその構成をで指定します。channelType``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設定オプションと使用可能なオプションのリストについては、APIリファレンスをmessageType参照してください。
Equinix Rest API
サブスクリプションを作成してEquinix APIからデータを利用できるようにするには、エンドポイントにリクエストを/smartview/v2/streaming/subscriptions送信します。POSTリクエストの本文で、ASを指定します。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": {
}
}
}'
で使用可能なオプションの完全なリストについては、APIリファレンスをmessageType参照してください。
回答例
HTTP/1.1 201 Created
Location: /smartview/v2/streaming/subscriptions/0f6bdb36-e130-4924-b038-ee1785fad999
Location応答のヘッダーには、リアルタイムフィードの利用に必要なサブスクリプションIDが含まれています。