Share via


ConfidentialLedgerClient.GetTransactionStatus(String, RequestContext) 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 Azure.Response GetTransactionStatus (string transactionId, Azure.RequestContext context = default);
abstract member GetTransactionStatus : string * Azure.RequestContext -> Azure.Response
override this.GetTransactionStatus : string * Azure.RequestContext -> Azure.Response
Public Overridable Function GetTransactionStatus (transactionId As String, Optional context As RequestContext = Nothing) As 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 GetTransactionStatus and parse the result.

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

Response response = client.GetTransactionStatus("<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 GetTransactionStatus with all parameters and parse the result.

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

Response response = client.GetTransactionStatus("<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