GetBlock - Amazon Quantum Ledger Database (Amazon QLDB)

GetBlock

Returns a block object at a specified address in a journal. Also returns a proof of the specified block for verification if DigestTipAddress is provided.

For information about the data contents in a block, see Journal contents in the Amazon QLDB Developer Guide.

If the specified ledger doesn't exist or is in DELETING status, then throws ResourceNotFoundException.

If the specified ledger is in CREATING status, then throws ResourcePreconditionNotMetException.

If no block exists with the specified address, then throws InvalidParameterException.

Request Syntax

POST /ledgers/name/block HTTP/1.1 Content-type: application/json { "BlockAddress": { "IonText": "string" }, "DigestTipAddress": { "IonText": "string" } }

URI Request Parameters

The request uses the following URI parameters.

name

The name of the ledger.

Length Constraints: Minimum length of 1. Maximum length of 32.

Pattern: (?!^.*--)(?!^[0-9]+$)(?!^-)(?!.*-$)^[A-Za-z0-9-]+$

Required: Yes

Request Body

The request accepts the following data in JSON format.

BlockAddress

The location of the block that you want to request. An address is an Amazon Ion structure that has two fields: strandId and sequenceNo.

For example: {strandId:"BlFTjlSXze9BIh1KOszcE3",sequenceNo:14}.

Type: ValueHolder object

Required: Yes

DigestTipAddress

The latest block location covered by the digest for which to request a proof. An address is an Amazon Ion structure that has two fields: strandId and sequenceNo.

For example: {strandId:"BlFTjlSXze9BIh1KOszcE3",sequenceNo:49}.

Type: ValueHolder object

Required: No

Response Syntax

HTTP/1.1 200 Content-type: application/json { "Block": { "IonText": "string" }, "Proof": { "IonText": "string" } }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

Block

The block data object in Amazon Ion format.

Type: ValueHolder object

Proof

The proof object in Amazon Ion format returned by a GetBlock request. A proof contains the list of hash values required to recalculate the specified digest using a Merkle tree, starting with the specified block.

Type: ValueHolder object

Errors

For information about the errors that are common to all actions, see Common Errors.

InvalidParameterException

One or more parameters in the request aren't valid.

HTTP Status Code: 400

ResourceNotFoundException

The specified resource doesn't exist.

HTTP Status Code: 404

ResourcePreconditionNotMetException

The operation failed because a condition wasn't satisfied in advance.

HTTP Status Code: 412

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: