Add bash function for accessing API

Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
This commit is contained in:
Jakub Sztandera 2020-08-08 17:10:09 +02:00
parent 5f157affdd
commit ae1ae58dd7
No known key found for this signature in database
GPG Key ID: 9A9AF56F8B3879BA

11
scripts/dev/api.bash Normal file
View File

@ -0,0 +1,11 @@
#!/bin/bash
# vim: set expandtab ts=2 sw=2:
token=$(lotus auth create-token --perm admin)
runAPI() {
curl -X POST \
-H "Content-Type: application/json" \
--data '{"jsonrpc":"2.0","id":2,"method":"Filecoin.'"$1"'","params":'"${2:-null}"'}' \
'http://127.0.0.1:1234/rpc/v0?token='"$token"
}