Connect to Core RPC Endpoints from Postman
What is Postman
Postman is a popular software offering that makes it easy to create and use APIs.
This guidebook covers the basics of hitting an RPC endpoint with Postman. It is not intended to be (or to replace) a full, end-to-end tutorial, but rather to offer an introduction to the subject.
Working with Core RPCs Through Postman
- First, you'll need to sign up for an account. Postman makes this very easy to do by allowing you to enter your account details or use a Gmail address manually.
- Projects in Postman are organized into "workspaces", so you'll need to make one to test this process. Click on the New button in the left navigation pane.
- You can choose from several different workspaces. For this example, we're going to use
HTTP
.
- This will take you to a basic workstation, where you can structure your RPC query and receive a response.
- First, change the
GET
request to aPOST
request, as that's how our query will be structured. Then, add the RPC URL that you want to use to get data related to a specific Core blockchain transaction. Remember that you can use any of the valid Core RPC URLs.
- Then, head over to the Body tab and add the data from the following CURL request (note that in this example, we are submitting the request as raw JSON).
curl -H "Content-Type: application/json" \
-X POST \
--data '{"jsonrpc":"2.0","method":"eth_getTransactionByHash","params":["0xc9c4a5d14857ace0db197c7393806868824763377f802645aacf6f38d9c309b7"],"id":1}' \
--url 'https://rpc.ankr.com/core'
- Once the
Send
button is clicked, you'll receive a response in JSON with all the information requested about the transaction whose hash was passed in the request.