Les API sous la version /beta dans Microsoft Graph sont susceptibles d’être modifiées. L’utilisation de ces API dans des applications de production n’est pas prise en charge. Pour déterminer si une API est disponible dans v1.0, utilisez le sélecteur Version .
Ingérer des données de télémétrie de capteur pour un appareil de capteur d’espace de travail.
Dans le corps de la demande, fournissez une représentation JSON des paramètres.
La propriété sensorId peut être omise dans l’objet workplaceSensorDeviceTelemetry pour les appareils avec des types de capteurs uniques. Lorsque cette propriété est omise, la valeur sensorType sert d’identificateur par défaut, ce qui est cohérent avec le comportement lorsque vous créez un appareil sans sensorId spécifié.
Le tableau suivant présente les paramètres que vous pouvez utiliser avec cette action.
Collection des données de télémétrie collectées et signalées par un capteur sur un appareil, telles que l’occupation, le nombre de personnes, l’occupation déduite, la température, etc.
Réponse
Si elle réussit, cette méthode renvoie un code de réponse 204 No Content.
Exemples
Exemple 1 : Envoyer des données de télémétrie de capteur pour un appareil avec des types de capteurs uniques
L’exemple suivant montre comment envoyer des données de télémétrie de capteur pour un appareil avec des types de capteurs uniques.
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Workplace.SensorDevices.IngestTelemetry;
using Microsoft.Graph.Beta.Models;
var requestBody = new IngestTelemetryPostRequestBody
{
Telemetry = new List<WorkplaceSensorDeviceTelemetry>
{
new WorkplaceSensorDeviceTelemetry
{
DeviceId = "contoso_9D6816",
SensorType = WorkplaceSensorType.Occupancy,
BoolValue = false,
Timestamp = DateTimeOffset.Parse("2021-03-31T09:36:05.144Z"),
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
await graphClient.Workplace.SensorDevices.IngestTelemetry.PostAsync(requestBody);
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.beta.workplace.sensordevices.ingesttelemetry.IngestTelemetryPostRequestBody ingestTelemetryPostRequestBody = new com.microsoft.graph.beta.workplace.sensordevices.ingesttelemetry.IngestTelemetryPostRequestBody();
LinkedList<WorkplaceSensorDeviceTelemetry> telemetry = new LinkedList<WorkplaceSensorDeviceTelemetry>();
WorkplaceSensorDeviceTelemetry workplaceSensorDeviceTelemetry = new WorkplaceSensorDeviceTelemetry();
workplaceSensorDeviceTelemetry.setDeviceId("contoso_9D6816");
workplaceSensorDeviceTelemetry.setSensorType(WorkplaceSensorType.Occupancy);
workplaceSensorDeviceTelemetry.setBoolValue(false);
OffsetDateTime timestamp = OffsetDateTime.parse("2021-03-31T09:36:05.144Z");
workplaceSensorDeviceTelemetry.setTimestamp(timestamp);
telemetry.add(workplaceSensorDeviceTelemetry);
ingestTelemetryPostRequestBody.setTelemetry(telemetry);
graphClient.workplace().sensorDevices().ingestTelemetry().post(ingestTelemetryPostRequestBody);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Workplace\SensorDevices\IngestTelemetry\IngestTelemetryPostRequestBody;
use Microsoft\Graph\Beta\Generated\Models\WorkplaceSensorDeviceTelemetry;
use Microsoft\Graph\Beta\Generated\Models\WorkplaceSensorType;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new IngestTelemetryPostRequestBody();
$telemetryWorkplaceSensorDeviceTelemetry1 = new WorkplaceSensorDeviceTelemetry();
$telemetryWorkplaceSensorDeviceTelemetry1->setDeviceId('contoso_9D6816');
$telemetryWorkplaceSensorDeviceTelemetry1->setSensorType(new WorkplaceSensorType('occupancy'));
$telemetryWorkplaceSensorDeviceTelemetry1->setBoolValue(false);
$telemetryWorkplaceSensorDeviceTelemetry1->setTimestamp(new \DateTime('2021-03-31T09:36:05.144Z'));
$telemetryArray []= $telemetryWorkplaceSensorDeviceTelemetry1;
$requestBody->setTelemetry($telemetryArray);
$graphServiceClient->workplace()->sensorDevices()->ingestTelemetry()->post($requestBody)->wait();
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.workplace.sensordevices.ingest_telemetry.ingest_telemetry_post_request_body import IngestTelemetryPostRequestBody
from msgraph_beta.generated.models.workplace_sensor_device_telemetry import WorkplaceSensorDeviceTelemetry
from msgraph_beta.generated.models.workplace_sensor_type import WorkplaceSensorType
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = IngestTelemetryPostRequestBody(
telemetry = [
WorkplaceSensorDeviceTelemetry(
device_id = "contoso_9D6816",
sensor_type = WorkplaceSensorType.Occupancy,
bool_value = False,
timestamp = "2021-03-31T09:36:05.144Z",
),
],
)
await graph_client.workplace.sensor_devices.ingest_telemetry.post(request_body)
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Workplace.SensorDevices.IngestTelemetry;
using Microsoft.Graph.Beta.Models;
var requestBody = new IngestTelemetryPostRequestBody
{
Telemetry = new List<WorkplaceSensorDeviceTelemetry>
{
new WorkplaceSensorDeviceTelemetry
{
DeviceId = "contoso_9D6816",
SensorId = "occupancy_1",
SensorType = WorkplaceSensorType.Occupancy,
BoolValue = false,
Timestamp = DateTimeOffset.Parse("2021-03-31T09:36:05.144Z"),
},
new WorkplaceSensorDeviceTelemetry
{
DeviceId = "contoso_9D6816",
SensorId = "occupancy_2",
SensorType = WorkplaceSensorType.Occupancy,
BoolValue = false,
Timestamp = DateTimeOffset.Parse("2021-03-31T09:36:05.144Z"),
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
await graphClient.Workplace.SensorDevices.IngestTelemetry.PostAsync(requestBody);
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.beta.workplace.sensordevices.ingesttelemetry.IngestTelemetryPostRequestBody ingestTelemetryPostRequestBody = new com.microsoft.graph.beta.workplace.sensordevices.ingesttelemetry.IngestTelemetryPostRequestBody();
LinkedList<WorkplaceSensorDeviceTelemetry> telemetry = new LinkedList<WorkplaceSensorDeviceTelemetry>();
WorkplaceSensorDeviceTelemetry workplaceSensorDeviceTelemetry = new WorkplaceSensorDeviceTelemetry();
workplaceSensorDeviceTelemetry.setDeviceId("contoso_9D6816");
workplaceSensorDeviceTelemetry.setSensorId("occupancy_1");
workplaceSensorDeviceTelemetry.setSensorType(WorkplaceSensorType.Occupancy);
workplaceSensorDeviceTelemetry.setBoolValue(false);
OffsetDateTime timestamp = OffsetDateTime.parse("2021-03-31T09:36:05.144Z");
workplaceSensorDeviceTelemetry.setTimestamp(timestamp);
telemetry.add(workplaceSensorDeviceTelemetry);
WorkplaceSensorDeviceTelemetry workplaceSensorDeviceTelemetry1 = new WorkplaceSensorDeviceTelemetry();
workplaceSensorDeviceTelemetry1.setDeviceId("contoso_9D6816");
workplaceSensorDeviceTelemetry1.setSensorId("occupancy_2");
workplaceSensorDeviceTelemetry1.setSensorType(WorkplaceSensorType.Occupancy);
workplaceSensorDeviceTelemetry1.setBoolValue(false);
OffsetDateTime timestamp1 = OffsetDateTime.parse("2021-03-31T09:36:05.144Z");
workplaceSensorDeviceTelemetry1.setTimestamp(timestamp1);
telemetry.add(workplaceSensorDeviceTelemetry1);
ingestTelemetryPostRequestBody.setTelemetry(telemetry);
graphClient.workplace().sensorDevices().ingestTelemetry().post(ingestTelemetryPostRequestBody);
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Workplace.SensorDevices.IngestTelemetry;
using Microsoft.Graph.Beta.Models;
var requestBody = new IngestTelemetryPostRequestBody
{
Telemetry = new List<WorkplaceSensorDeviceTelemetry>
{
new WorkplaceSensorDeviceTelemetry
{
DeviceId = "contoso_9D6816",
SensorType = WorkplaceSensorType.Occupancy,
BoolValue = false,
Timestamp = DateTimeOffset.Parse("2021-03-31T09:36:05.144Z"),
},
new WorkplaceSensorDeviceTelemetry
{
DeviceId = "contoso_9D6817",
SensorType = WorkplaceSensorType.Occupancy,
BoolValue = false,
Timestamp = DateTimeOffset.Parse("2021-03-31T09:36:05.144Z"),
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
await graphClient.Workplace.SensorDevices.IngestTelemetry.PostAsync(requestBody);
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.beta.workplace.sensordevices.ingesttelemetry.IngestTelemetryPostRequestBody ingestTelemetryPostRequestBody = new com.microsoft.graph.beta.workplace.sensordevices.ingesttelemetry.IngestTelemetryPostRequestBody();
LinkedList<WorkplaceSensorDeviceTelemetry> telemetry = new LinkedList<WorkplaceSensorDeviceTelemetry>();
WorkplaceSensorDeviceTelemetry workplaceSensorDeviceTelemetry = new WorkplaceSensorDeviceTelemetry();
workplaceSensorDeviceTelemetry.setDeviceId("contoso_9D6816");
workplaceSensorDeviceTelemetry.setSensorType(WorkplaceSensorType.Occupancy);
workplaceSensorDeviceTelemetry.setBoolValue(false);
OffsetDateTime timestamp = OffsetDateTime.parse("2021-03-31T09:36:05.144Z");
workplaceSensorDeviceTelemetry.setTimestamp(timestamp);
telemetry.add(workplaceSensorDeviceTelemetry);
WorkplaceSensorDeviceTelemetry workplaceSensorDeviceTelemetry1 = new WorkplaceSensorDeviceTelemetry();
workplaceSensorDeviceTelemetry1.setDeviceId("contoso_9D6817");
workplaceSensorDeviceTelemetry1.setSensorType(WorkplaceSensorType.Occupancy);
workplaceSensorDeviceTelemetry1.setBoolValue(false);
OffsetDateTime timestamp1 = OffsetDateTime.parse("2021-03-31T09:36:05.144Z");
workplaceSensorDeviceTelemetry1.setTimestamp(timestamp1);
telemetry.add(workplaceSensorDeviceTelemetry1);
ingestTelemetryPostRequestBody.setTelemetry(telemetry);
graphClient.workplace().sensorDevices().ingestTelemetry().post(ingestTelemetryPostRequestBody);
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.workplace.sensordevices.ingest_telemetry.ingest_telemetry_post_request_body import IngestTelemetryPostRequestBody
from msgraph_beta.generated.models.workplace_sensor_device_telemetry import WorkplaceSensorDeviceTelemetry
from msgraph_beta.generated.models.workplace_sensor_type import WorkplaceSensorType
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = IngestTelemetryPostRequestBody(
telemetry = [
WorkplaceSensorDeviceTelemetry(
device_id = "contoso_9D6816",
sensor_type = WorkplaceSensorType.Occupancy,
bool_value = False,
timestamp = "2021-03-31T09:36:05.144Z",
),
WorkplaceSensorDeviceTelemetry(
device_id = "contoso_9D6817",
sensor_type = WorkplaceSensorType.Occupancy,
bool_value = False,
timestamp = "2021-03-31T09:36:05.144Z",
),
],
)
await graph_client.workplace.sensor_devices.ingest_telemetry.post(request_body)