Share via


WorkflowRunClient.GetWorkflowRunAsync(Guid, RequestContext) Method

Definition

[Protocol Method] Get a workflow run.

  • This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
public virtual System.Threading.Tasks.Task<Azure.Response> GetWorkflowRunAsync (Guid workflowRunId, Azure.RequestContext context);
abstract member GetWorkflowRunAsync : Guid * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.GetWorkflowRunAsync : Guid * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function GetWorkflowRunAsync (workflowRunId As Guid, context As RequestContext) As Task(Of Response)

Parameters

workflowRunId
Guid

The workflow run id.

context
RequestContext

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

Returns

The response returned from the service.

Exceptions

Service returned a non-success status code.

Examples

This sample shows how to call GetWorkflowRunAsync and parse the result.

Uri endpoint = new Uri("<endpoint>");
TokenCredential credential = new DefaultAzureCredential();
WorkflowRunClient client = new WorkflowRunClient(endpoint, credential);

Response response = await client.GetWorkflowRunAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null);

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("actionDag").ToString());
Console.WriteLine(result.GetProperty("detail").GetProperty("runInput").ToString());
Console.WriteLine(result.GetProperty("detail").GetProperty("actions").ToString());

This sample shows how to call GetWorkflowRunAsync with all parameters and parse the result.

Uri endpoint = new Uri("<endpoint>");
TokenCredential credential = new DefaultAzureCredential();
WorkflowRunClient client = new WorkflowRunClient(endpoint, credential);

Response response = await client.GetWorkflowRunAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null);

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("id").ToString());
Console.WriteLine(result.GetProperty("workflowId").ToString());
Console.WriteLine(result.GetProperty("startTime").ToString());
Console.WriteLine(result.GetProperty("requestor").ToString());
Console.WriteLine(result.GetProperty("userRequestId").ToString());
Console.WriteLine(result.GetProperty("runPayload").GetProperty("type").ToString());
Console.WriteLine(result.GetProperty("runPayload").GetProperty("targetValue").ToString());
Console.WriteLine(result.GetProperty("runPayload").GetProperty("payload").ToString());
Console.WriteLine(result.GetProperty("status").ToString());
Console.WriteLine(result.GetProperty("endTime").ToString());
Console.WriteLine(result.GetProperty("cancelTime").ToString());
Console.WriteLine(result.GetProperty("cancelComment").ToString());
Console.WriteLine(result.GetProperty("actionDag").ToString());
Console.WriteLine(result.GetProperty("detail").GetProperty("runInput").ToString());
Console.WriteLine(result.GetProperty("detail").GetProperty("actions").ToString());

Applies to