ConfidentialLedgerClient.GetLedgerEntries Method

Definition

[Protocol Method] Gets ledger entries from a collection corresponding to a range.

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

Parameters

collectionId
String

The collection id.

fromTransactionId
String

Specify the first transaction ID in a range.

toTransactionId
String

Specify the last transaction ID in a range.

context
RequestContext

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

Returns

The Pageable<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 GetLedgerEntries and parse the result.

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

foreach (BinaryData item in client.GetLedgerEntries())
{
    JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
    Console.WriteLine(result.GetProperty("contents").ToString());
}

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

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

foreach (BinaryData item in client.GetLedgerEntries(collectionId: "<collectionId>", fromTransactionId: "<fromTransactionId>", toTransactionId: "<toTransactionId>"))
{
    JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
    Console.WriteLine(result.GetProperty("contents").ToString());
    Console.WriteLine(result.GetProperty("collectionId").ToString());
    Console.WriteLine(result.GetProperty("transactionId").ToString());
}

Remarks

A collection id may optionally be specified. Only entries in the specified (or default) collection will be returned.

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

Response Body:

Schema for LedgerEntries:

{
  contents: string, # Required. Contents of the ledger entry.
  collectionId: string, # Optional.
  transactionId: string, # Optional. 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