Getting Harmony API endpoint
- Set up account on GetBlock: you can sign up with either e-mail address or MetaMask wallet: https://account.getblock.io/
- Create New Project by clicking ‘+’ and choosing the name for it.
- In the list of protocols choose ‘Harmony’ mainnet and click ‘Get’ to obtain our RPC endpoint address.
- That’s it: now you can use your endpoint (https://one.getblock.io/……/mainnet/ ) to connect to Harmony.
- You can switch between JSON RPC and WebSockets interfaces.
Testing Harmony API endpoint by GetBlock
- Let’s try it: via the Postman API platform we can retrieve the header of the latest Harmony block. To do so, let’s create a new API request.
- We need to set POST as a type of request and our endpoint URL as an API key. Let’s take the request sample here: https://docs.harmony.one/home/developers/harmony-specifics/api/methods/blockchain-related-methods/hmy_latestheader (‘Sample Curl Request’ field)
- Then, we need to copy the request to ‘Body’ field, choose ‘RAW’ as a type of data and JSON as a format.
- Click ‘Send’. We’re good to go: in ‘Response’ field, we can find the information we requested.