Gestion des abonnements
Vous pouvez gérer vos abonnements en utilisant les points de terminaison API suivants.
Conditions préalables
- Veuillez fournir vos identifiants utilisateur, votre identifiant client et votre clé secrète client pour l'authentification OAuth2. Consultez la section Authentification API pour plus d'informations sur l'authentification de vos requêtes auprès de l'API Equinix.
Obtenez vos abonnements
Pour obtenir la liste de tous vos abonnements de diffusion en continu, envoyez une requête GET au point de terminaison /smartview/v2/streaming/subscriptions.
Exemple de requête cURL:
curl -X
GET 'https://api.equinix.com/smartview/v2/streaming/subscriptions'
-H 'authorization: Bearer <token>'
Exemple de réponse:
[
{
"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"
}
]
Obtenez les détails des abonnements
Pour obtenir les détails d'un abonnement spécifique, envoyez une requête GET au point de terminaison /smartview/v2/streaming/subscriptions/{id}.
Exemple de requête cURL:
curl -X
GET 'https://api.equinix.com/smartview/v2/streaming/subscriptions/606349eca6171829c70d8777'
-H 'authorization: Bearer <token>'
Exemple de réponse:
{
"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"
}
Mettre à jour un abonnement
Pour modifier un abonnement, envoyez une requête PUT au point de terminaison /smartview/v2/streaming/subscriptions/{id}. Le corps de la nouvelle requête remplace la configuration d'abonnement actuelle.
Exemple de requête 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"
}
}
}'
Supprimer un abonnement
Pour supprimer un abonnement, envoyez une requête DELETE au point de terminaison /smartview/v2/streaming/subscriptions/{id}. Les événements associés à cet abonnement ne seront plus disponibles une fois la requête de suppression reçue.
Exemple de requête cURL:
curl -X
DELETE 'https://api.equinix.com/smartview/v2/streaming/subscriptions/606349eca6171829c70d8777'
-H 'authorization: Bearer <token>'