Assume I have a table deployed on chain. I know if I have a key, I can lookup the value like this:
Given a key, how do I read the value from a table via the API?
But what if I don't know the key? How do I lookup all the keys in a table via the API?
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