DeviceManagementClient.GetOperationStatusesAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Get a list of all device import operations. Completed operations are kept for 7 days before auto-deleted.
public virtual Azure.AsyncPageable<BinaryData> GetOperationStatusesAsync (string filter = default, int? top = default, Azure.RequestContext context = default);
abstract member GetOperationStatusesAsync : string * Nullable<int> * Azure.RequestContext -> Azure.AsyncPageable<BinaryData>
override this.GetOperationStatusesAsync : string * Nullable<int> * Azure.RequestContext -> Azure.AsyncPageable<BinaryData>
Public Overridable Function GetOperationStatusesAsync (Optional filter As String = Nothing, Optional top As Nullable(Of Integer) = Nothing, Optional context As RequestContext = Nothing) As AsyncPageable(Of BinaryData)
Parameters
- filter
- String
Restricts the set of operations returned. Only one specific filter is supported: "status eq 'NotStarted' or status eq 'Running'".
Specifies a non-negative integer n that limits the number of items returned from a collection. The service returns the number of available items up to but not greater than the specified value n.
- context
- RequestContext
The request context, which can override default behaviors of the client pipeline on a per-call basis.
Returns
The AsyncPageable<T> from the service containing a list of BinaryData objects. Details of the body schema for each item in the collection are in the Remarks section below.
Exceptions
Service returned a non-success status code.
Examples
This sample shows how to call GetOperationStatusesAsync 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.GetOperationStatusesAsync())
{
JsonElement result = JsonDocument.Parse(data.ToStream()).RootElement;
Console.WriteLine(result.GetProperty("operationId").ToString());
Console.WriteLine(result.GetProperty("status").ToString());
Console.WriteLine(result.GetProperty("lastActionDateTime").ToString());
Console.WriteLine(result.GetProperty("createdDateTime").ToString());
}
This sample shows how to call GetOperationStatusesAsync with all parameters, and how to 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.GetOperationStatusesAsync("<filter>", 1234))
{
JsonElement result = JsonDocument.Parse(data.ToStream()).RootElement;
Console.WriteLine(result.GetProperty("operationId").ToString());
Console.WriteLine(result.GetProperty("status").ToString());
Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString());
Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString());
Console.WriteLine(result.GetProperty("error").GetProperty("target").ToString());
Console.WriteLine(result.GetProperty("error").GetProperty("innererror").GetProperty("code").ToString());
Console.WriteLine(result.GetProperty("error").GetProperty("innererror").GetProperty("message").ToString());
Console.WriteLine(result.GetProperty("error").GetProperty("innererror").GetProperty("errorDetail").ToString());
Console.WriteLine(result.GetProperty("error").GetProperty("occurredDateTime").ToString());
Console.WriteLine(result.GetProperty("traceId").ToString());
Console.WriteLine(result.GetProperty("lastActionDateTime").ToString());
Console.WriteLine(result.GetProperty("createdDateTime").ToString());
Console.WriteLine(result.GetProperty("etag").ToString());
}
Remarks
Below is the JSON schema for one item in the pageable response.
Response Body:
Schema for DeviceOperationsListValue
:
{
operationId: string, # Required. Operation Id.
status: "NotStarted" | "Running" | "Succeeded" | "Failed", # Required. Operation status.
error: {
code: string, # Required. Server defined error code.
message: string, # Required. A human-readable representation of the error.
target: string, # Optional. The target of the error.
details: [Error], # Optional. An array of errors that led to the reported error.
innererror: {
code: string, # Required. A more specific error code than what was provided by the containing error.
message: string, # Optional. A human-readable representation of the error.
errorDetail: string, # Optional. The internal error or exception message.
innerError: InnerError, # Optional. An object containing more specific information than the current object about the error.
}, # Optional. An object containing more specific information than the current object about the error.
occurredDateTime: string (ISO 8601 Format), # Optional. Date and time in UTC when the error occurred.
}, # Optional. Operation error encountered, if any.
traceId: string, # Optional. Operation correlation identity that can used by Microsoft Support for troubleshooting.
lastActionDateTime: string (ISO 8601 Format), # Required. Date and time in UTC when the operation status was last updated.
createdDateTime: string (ISO 8601 Format), # Required. Date and time in UTC when the operation was created.
etag: string, # Optional. Operation ETag.
}
Applies to
Azure SDK for .NET