次の方法で共有


ConfidentialLedgerClient.CreateLedgerEntry メソッド

定義

[プロトコルメソッド]台帳エントリを書き込みます。

  • この プロトコルメソッド を使用すると、高度なシナリオで応答の要求と処理を明示的に作成できます。
public virtual Azure.Response CreateLedgerEntry (Azure.Core.RequestContent content, string collectionId = default, Azure.RequestContext context = default);
abstract member CreateLedgerEntry : Azure.Core.RequestContent * string * Azure.RequestContext -> Azure.Response
override this.CreateLedgerEntry : Azure.Core.RequestContent * string * Azure.RequestContext -> Azure.Response
Public Overridable Function CreateLedgerEntry (content As RequestContent, Optional collectionId As String = Nothing, Optional context As RequestContext = Nothing) As Response

パラメーター

content
RequestContent

要求の本文として送信するコンテンツ。

collectionId
String

コレクション ID。

context
RequestContext

要求コンテキスト。これは、呼び出しごとにクライアント パイプラインの既定の動作をオーバーライドできます。

戻り値

サービスから返された応答。

例外

content が null です。

サービスから成功以外の状態コードが返されました。

このサンプルでは、必要なパラメーターと要求コンテンツを使用して CreateLedgerEntry を呼び出す方法と、結果を解析する方法を示します。

var credential = new DefaultAzureCredential();
var endpoint = new Uri("<https://my-service.azure.com>");
var client = new ConfidentialLedgerClient(endpoint, credential);

var data = new {
    contents = "<contents>",
};

Response response = client.CreateLedgerEntry(RequestContent.Create(data));

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

このサンプルでは、すべてのパラメーターと要求コンテンツを使用して CreateLedgerEntry を呼び出す方法と、結果を解析する方法を示します。

var credential = new DefaultAzureCredential();
var endpoint = new Uri("<https://my-service.azure.com>");
var client = new ConfidentialLedgerClient(endpoint, credential);

var data = new {
    contents = "<contents>",
};

Response response = client.CreateLedgerEntry(RequestContent.Create(data), "<collectionId>");

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

注釈

必要に応じて、コレクション ID を指定できます。

要求と応答のペイロードの JSON スキーマを次に示します。

要求本文:

LedgerEntryスキーマ:

{
  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.
}

応答本文:

LedgerWriteResultスキーマ:

{
  collectionId: string, # Required.
}

適用対象