Share via


ConfidentialLedgerClient.GetTransactionStatusAsync Method

Definition

[Protocol Method] Gets the status of an entry identified by a transaction id.

  • 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> GetTransactionStatusAsync (string transactionId, Azure.RequestContext context = default);
abstract member GetTransactionStatusAsync : string * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.GetTransactionStatusAsync : string * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function GetTransactionStatusAsync (transactionId As String, Optional context As RequestContext = Nothing) As Task(Of Response)

Parameters

transactionId
String

Identifies a write transaction.

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

transactionId is null.

transactionId 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 GetTransactionStatusAsync and parse the result.

TokenCredential credential = new DefaultAzureCredential();
ConfidentialLedgerClient client = new ConfidentialLedgerClient(new Uri("http://localhost:3000"), credential);

Response response = await client.GetTransactionStatusAsync("<transactionId>");

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("state").ToString());
Console.WriteLine(result.GetProperty("transactionId").ToString());

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

TokenCredential credential = new DefaultAzureCredential();
ConfidentialLedgerClient client = new ConfidentialLedgerClient(new Uri("http://localhost:3000"), credential);

Response response = await client.GetTransactionStatusAsync("<transactionId>");

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("state").ToString());
Console.WriteLine(result.GetProperty("transactionId").ToString());

Remarks

Below is the JSON schema for the response payload.

Response Body:

Schema for TransactionStatus:

{
  state: "Committed" | "Pending", # Required. Represents the state of the transaction.
  transactionId: string, # Required. A unique identifier for the state of the ledger. If returned as part of a LedgerEntry, it indicates the state from which the entry was read.
}

Applies to