サブスクリプションの作成
データコレクターのセットアップと構成が完了したら、コロケーションデータをデータコレクターにストリーミングするためのサブスクリプションを作成します。
組織で使用できる通信チャネルタイプは1つのみ。たとえば、AWS IoTコアチャネルでサブスクリプションを作成した場合、別のチャネルタイプを使用して別のサブスクリプションを作成することはできない。
1つのサブスクリプションで使用できるチャンネルは1つのみです。
前提条件
-
Subscription Management APIを呼び出す前に、データの宛先を設定および構成するためにコレクタとの統合を参照してください。
-
OAuth2認証用のユーザー資格情報、クライアントID、およびクライアントシークレットを送信する。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"
}
}
}'
で使用可能なオプションの一覧については、messageType『APIリファレンス』を参照。
Azure イベントハブ
Azureチャネルサブスクリプションを作成するには、サポートにお問い合わせください。
ウェブフック
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設定オプションと使用可能なオプションのリストについては、messageType『APIリファレンス』を参照。
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": {
}
}
}'
で使用可能なオプションの一覧については、messageType『APIリファレンス』を参照。
回答例
HTTP/1.1 201 Created
Location: /smartview/v2/streaming/subscriptions/0f6bdb36-e130-4924-b038-ee1785fad999
Locationレスポンスのヘッダーには、リアルタイムフィードを使用するために必要なサブスクリプションIDが含まれている。