From ae1ae58dd74d782eae2466a6b9f0e75a2e7addca Mon Sep 17 00:00:00 2001 From: Jakub Sztandera Date: Sat, 8 Aug 2020 17:10:09 +0200 Subject: [PATCH] Add bash function for accessing API Signed-off-by: Jakub Sztandera --- scripts/dev/api.bash | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 scripts/dev/api.bash diff --git a/scripts/dev/api.bash b/scripts/dev/api.bash new file mode 100644 index 000000000..5539e4fef --- /dev/null +++ b/scripts/dev/api.bash @@ -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" +}