Język

DeviceManagementClient.GetBestUpdatesForGroupsAsync Method

Definition

[Protocol Method] Get the best available updates for a device group and a count of how many devices need each update.

  • This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
public virtual Azure.AsyncPageable<BinaryData> GetBestUpdatesForGroupsAsync(string groupId, Azure.RequestContext context = default);
abstract member GetBestUpdatesForGroupsAsync : string * Azure.RequestContext -> Azure.AsyncPageable<BinaryData>
override this.GetBestUpdatesForGroupsAsync : string * Azure.RequestContext -> Azure.AsyncPageable<BinaryData>
Public Overridable Function GetBestUpdatesForGroupsAsync (groupId As String, Optional context As RequestContext = Nothing) As AsyncPageable(Of BinaryData)

Parameters

groupId
String

Group identifier.

context
RequestContext

The request options, which can override default behaviors of the client pipeline on a per-call basis.

Returns

The response returned from the service.

Exceptions

groupId is null.

groupId is an empty string, and was expected to be non-empty.

Service returned a non-success status code.

Examples

This sample shows how to call GetBestUpdatesForGroupsAsync with required parameters and parse the result.

var credential = new DefaultAzureCredential();
var endpoint = new Uri("<https://my-service.azure.com>");
var client = new DeviceManagementClient(endpoint, "<instanceId>", credential);

await foreach (var data in client.GetBestUpdatesForGroupsAsync("<groupId>"))
{
    JsonElement result = JsonDocument.Parse(data.ToStream()).RootElement;
    Console.WriteLine(result.GetProperty("groupId").ToString());
    Console.WriteLine(result.GetProperty("deviceClassId").ToString());
    Console.WriteLine(result.GetProperty("update").GetProperty("updateId").GetProperty("provider").ToString());
    Console.WriteLine(result.GetProperty("update").GetProperty("updateId").GetProperty("name").ToString());
    Console.WriteLine(result.GetProperty("update").GetProperty("updateId").GetProperty("version").ToString());
    Console.WriteLine(result.GetProperty("update").GetProperty("description").ToString());
    Console.WriteLine(result.GetProperty("update").GetProperty("friendlyName").ToString());
    Console.WriteLine(result.GetProperty("deviceCount").ToString());
}

Remarks

Below is the JSON schema for one item in the pageable response.

Response Body:

Schema for DeviceClassSubgroupUpdatableDevicesListValue:

{
              groupId: string, # Required. The group Id
              deviceClassId: string, # Required. The device class subgroup's device class Id
              update: {
                updateId: {
                  provider: string, # Required. Update provider.
                  name: string, # Required. Update name.
                  version: string, # Required. Update version.
                }, # Required. Update identifier.
                description: string, # Optional. Update description.
                friendlyName: string, # Optional. Friendly update name.
              }, # Required. Update information.
              deviceCount: number, # Required. Total number of devices for which the update is applicable.
            }

Applies to