サブスクリプションの作成
データコレクターのセットアップと構成が完了したら、コロケーションデータをデータコレクターにストリーミングするためのサブスクリプションを作成します。
組織内で使用できる通信チャネルタイプは1つだけです。例えば、AWS IoT Core チャネルでサブスクリプションを作成した場合、別のチャネルタイプを使用して別のサブスクリプションを作成することはできません。
1つのサブスクリプションで使用できるチャンネルは1つのみです。
前提条件
-
サブスクリプション管理 API を呼び出す前に、コレクターとの統合 を参照して、データの送信先を設定および構成してください。
-
OAuth2認証のためのユーザー認証情報、クライアントID、クライアントシークレットを送信します。Equinix APIへのリクエストを認証する方法については、「API認証」(../../equinix-api/api-authentication.md)を参照してください。
AWS IoTコア
Amazon IoT Core にデータを送信するサブスクリプションを作成するには、/smartview/v2/streaming/subscriptions エンドポイントに POST リクエストを送信します。リクエストの本文で channelType を AWS_IOT_CORE に、その URL を 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 リクエストを送信します。リクエストの本文で channelType を WEBHOOK に、その設定を 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リクエストを送信します。リクエストの本文で 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 が含まれています。