Query the ledger
In this guide, you will learn how to retrieve information from a ledger using the MARCO API.
Prerequisites
Before you start, complete the following prerequisites:
Search actions by wallet ID
To get all the actions where a wallet was involved either as a sender or a receiver, send a GET
request to the Search by wallet ID endpoint as follows:
curl --location --request GET 'https://api-marco.finboot.com/v1/ledger/ops/search/wallets/<WALLET_ID>/actions' \
--header 'ApplicationToken: <APPLICATION_TOKEN>' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <ACCESS_TOKEN>'
Replace:
WALLET_ID
: The resource ID of the wallet involved in the action. For example,WAL-62EPFgDCGOM
. Note that the service account making the request must have access to this wallet. For more information, see Authorize wallet access to the service account.APPLICATION_TOKEN
: The marpp token. For guidance on obtaining this token, see the Quickstart guide.ACCESS_TOKEN
: The access token. For guidance on obtaining this token, ssee the Quickstart guide.
The endpoint allows you to apply filters to refine the results. For example, you can filter by intent. For example, you can filter by. For more information, see the complete API reference.
You will receive a paginated response similar to the following:
{
"contentType": "ActionPage",
"pageElements": 200,
"pageNumber": null,
"totalElements": 2,
"totalPages": 1,
"pageContent": [
{
"actionId": "0d5081c2-d4c1-4612-958c-606ffd987e26",
"dateUpdated": "Fri May 19 15:41:39 UTC 2023",
"dependencies": [],
"intent": "5ff541af-a2be-49c7-b345-b7ea048b231a",
"ledgerId": "finboot-clique-v1",
"locator": "0x211de19d275464a4e0f5b622f2b0d7b5c1232d625182b5a4609a94143c473a7f",
"status": "succeeded",
"txId": "0x211de19d275464a4e0f5b622f2b0d7b5c1232d625182b5a4609a94143c473a7f",
"walletId": "WAL-62EPFgDCGOM"
},
{
"actionId": "ac4d8d94-86e9-48b3-a8f1-12fad3b8e1d3",
"dateUpdated": "Fri May 19 16:37:11 UTC 2023",
"intent": "",
"ledgerId": null,
"locator": null,
"status": "pending",
"txId": null,
"walletId": "WAL-62EPFgDCGOM"
},
]
}
Get action details
To get the details of an action by its action ID, follow these steps, send a GET
request to the Find by action ID endpoint as follows:
curl --location --request GET 'https://api-marco.finboot.com/v1/ledger/ops/search/wallets/<WALLET_ID>/actions/<ACTION_ID>' \
--header 'ApplicationToken: <APPLICATION_TOKEN>' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <ACCESS_TOKEN>'
Replace:
WALLET_ID
: The resource ID of the wallet involved in the action. For example,WAL-62EPFgDCGOM
. Note that the service account making the request must have access to this wallet. For more information, see Authorize wallet access to the service account.ACTION_ID
: The resource ID of the action to query. For exampleac4d8d94-86e9-48b3-a8f1-12fad3b8e1d3
.APPLICATION_TOKEN
: The marpp token. For guidance on obtaining this token, see the Quickstart guide.ACCESS_TOKEN
: The access token. For guidance on obtaining this token, ssee the Quickstart guide.
You will receive a response similar to the following:
{
"actionId": "a6a9d972-a8ac-47f1-bd91-b00de153ce2d",
"dateUpdated": "Tue May 23 11:00:55 UTC 2023",
"dependencies": [],
"intent": "cb46cca9-774b-4537-b33b-2f29864d54a8",
"ledgerId": "finboot-clique-v1",
"locator": "0x5ecd1176e5786999ac730210d7d32658304f3ac14294f9a0e59ea1c6de245ccc",
"status": "succeeded",
"txId": "0x5ecd1176e5786999ac730210d7d32658304f3ac14294f9a0e59ea1c6de245ccc",
"walletId": "WAL-62EPFgDCGOM"
}
If status
is set to succedded
, this means the action has received at least one confirmation from the ledger.