Last active
September 30, 2022 20:55
-
-
Save vastus/003e0bed58973ea17859365f5ad3ded0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Usage: | |
# EMAIL='[email protected]' PASSWORD='your password' bash api_v2_getting_started.sh | |
TOKEN= | |
GET() { | |
curl -s -H 'content-type: application/json' \ | |
-H "authorization: Bearer ${TOKEN}" \ | |
"https://api.tokenterminal.com$1" | |
} | |
POST() { | |
curl -s -H 'content-type: application/json' \ | |
"https://api.tokenterminal.com$1" \ | |
-d "$2" | |
} | |
# get the API token | |
# note: login/logout/account resources are still under v1/ | |
TOKEN=$(POST "/v1/login" '{"email": "'${EMAIL:?}'", "password": "'${PASSWORD:?}'"}' | jq -r '.token') | |
# see which metrics are available for AAVE | |
aave_metric_availability="/v2/projects/aave" | |
echo "GET $aave_metric_availability" | |
GET "$aave_metric_availability" | jq '.' | |
echo | |
echo "------------------------" | |
echo | |
# query AAVE fees and revenue | |
aave_fees_revenues="/v2/projects/aave/metrics?&start=2022-09-22&metrics=fees,revenue" | |
echo "GET $aave_fees_revenues" | |
GET $aave_fees_revenues | jq '.' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.