I can see via the docs on the REST API here that the command to get a block can return either JSON
or msgpack
, via an optional format
query parameter.
However when I try and grab a msgpack
encoded block via curl, I can’t get it to return the expected output:
> curl "<endpoint-here>/v2/blocks/20245195?format=msgpack"
> {"message":"Unknown parameter detected: format"}
How can I get the block in msgpack
format?
Welcome to Algorand!
This works on my computer:
$ curl -s "https://testnet-api.algonode.cloud/v2/blocks/20245195?format=msgpack" | msgpacktool -d -b32
Are you sure you are using an algod
endpoint as opposed to an indexer endpoint?
The indexer indeed returns the message you indicate:
$ curl -s "https://testnet-idx.algonode.cloud/v2/blocks/20245195?format=msgpack"
{"message":"Unknown parameter detected: format"}
That will teach me not to use just IPs for the indexer and REST apis - you’re completely correct, I was querying the indexer. Thanks for the help!