ConfidentialLedgerClient.GetReceipt(String, RequestContext) 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.
[Protocol Method] Gets a receipt certifying ledger contents at a particular transaction id.
- This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
public virtual Azure.Response GetReceipt (string transactionId, Azure.RequestContext context = default);
abstract member GetReceipt : string * Azure.RequestContext -> Azure.Response
override this.GetReceipt : string * Azure.RequestContext -> Azure.Response
Public Overridable Function GetReceipt (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 GetReceipt and parse the result.
TokenCredential credential = new DefaultAzureCredential();
ConfidentialLedgerClient client = new ConfidentialLedgerClient(new Uri("http://localhost:3000"), credential);
Response response = client.GetReceipt("<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 GetReceipt with all parameters and parse the result.
TokenCredential credential = new DefaultAzureCredential();
ConfidentialLedgerClient client = new ConfidentialLedgerClient(new Uri("http://localhost:3000"), credential);
Response response = client.GetReceipt("<transactionId>");
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("receipt").GetProperty("cert").ToString());
Console.WriteLine(result.GetProperty("receipt").GetProperty("leaf").ToString());
Console.WriteLine(result.GetProperty("receipt").GetProperty("leafComponents").GetProperty("claimsDigest").ToString());
Console.WriteLine(result.GetProperty("receipt").GetProperty("leafComponents").GetProperty("commitEvidence").ToString());
Console.WriteLine(result.GetProperty("receipt").GetProperty("leafComponents").GetProperty("writeSetDigest").ToString());
Console.WriteLine(result.GetProperty("receipt").GetProperty("nodeId").ToString());
Console.WriteLine(result.GetProperty("receipt").GetProperty("proof")[0].GetProperty("left").ToString());
Console.WriteLine(result.GetProperty("receipt").GetProperty("proof")[0].GetProperty("right").ToString());
Console.WriteLine(result.GetProperty("receipt").GetProperty("root").ToString());
Console.WriteLine(result.GetProperty("receipt").GetProperty("serviceEndorsements")[0].ToString());
Console.WriteLine(result.GetProperty("receipt").GetProperty("signature").ToString());
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 TransactionReceipt
:
{
receipt: {
cert: string, # Optional.
leaf: string, # Optional.
leafComponents: {
claimsDigest: string, # Optional.
commitEvidence: string, # Optional.
writeSetDigest: string, # Optional.
}, # Optional.
nodeId: string, # Required.
proof: [
{
left: string, # Optional.
right: string, # Optional.
}
], # Required.
root: string, # Optional.
serviceEndorsements: [string], # Optional.
signature: string, # Required.
}, # Optional.
state: "Loading" | "Ready", # Required. State of a ledger query.
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
Azure SDK for .NET