Make requests

HTTPS or WebSocket

Use curl to make HTTPS requests and wscat for WebSocket requests.
1
curl -X POST -H "Content-Type: application/json" \
2
--user <PROJECT_ID>:<PROJECT_SECRET> \
3
--url https://<PROJECT_ID>:<PROJECT_SECRET>@filecoin.infura.io \
4
--data '{ "id": 0, "jsonrpc": "2.0", "method": "Filecoin.ChainHead", "params": [] }'
Copied!
1
wscat --auth <PROJECT_ID>:<PROJECT_SECRET> --connect wss://<PROJECT_ID>:<PROJECT_SECRET>@filecoin.infura.io
2
> { "jsonrpc": "2.0", "method": "Filecoin.ChainNotify", "params": [], "id": 3 }
Copied!
Replace<PROJECT-ID> and <PROJECT-SECRET> with the Filecoin project data in your Infura dashboard.
HTTPS
WebSocket
1
curl -X POST -H "Content-Type: application/json" \
2
--user <PROJECT_ID>:<PROJECT_SECRET> \
3
--url https://<PROJECT_ID>:<PROJECT_SECRET>@filecoin.infura.io \
4
--data '{ "id": 0, "jsonrpc": "2.0", "method": "Filecoin.ChainHead", "params": [] }'
Copied!
1
wscat --auth <PROJECT_ID>:<PROJECT_SECRET> --connect wss://<PROJECT_ID>:<PROJECT_SECRET>@filecoin.infura.io
2
> { "jsonrpc": "2.0", "method": "Filecoin.ChainNotify", "params": [], "id": 3 }
Copied!
Response looks something like:
Copy link