-
Originally from Stack Overflow. Assume I have a table deployed on chain. I know if I have a key, I can lookup the value like this: But what if I don't know the key? How do I lookup all the keys in a table via the API? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Indexer APIYou can make a query to the query MyQuery {
table_items(
where: {table_handle: {_eq: "0xd71c4400706e2addf04f8728fbc4f0a87d0612456cdcec95ae8fea0a4bd31b67"}}
limit: 100
offset: 0
) {
key
}
} Each request increase Learn about the indexer API here: https://aptos.dev/indexer/api/. Node APIUnfortunately with regular tables there is no way to do this via the node API right now. Alternatives
|
Beta Was this translation helpful? Give feedback.
Indexer API
You can make a query to the
table_items
table. You will need to paginate to get all the items:Each request increase
offset
bylimit
(e.g. in this case, by 100 each time). Continue until the response has fewer than 100 items.Learn about the indexer API here: https://aptos.dev/indexer/api/.
Node API
Unfortunately with regular tables there is no way to do this via the node API right now.
Alternatives