Created
September 23, 2018 13:38
-
-
Save 44uk/744c74c5f95a524f5888d501fd0117f4 to your computer and use it in GitHub Desktop.
Get all nem namespace from Node
This file contains 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 | |
nodeUrl=http://88.99.192.82:7890 # huge alice | |
# nodeUrl=http://176.9.68.110:7890 # huge alice 2 | |
# nodeUrl=http://176.9.20.180:7890 # huge alice 3 | |
tempDir=/tmp/_get_all_nem_namespace | |
lastId=99999 | |
[ -d $tempDir ] || mkdir -p $tempDir | |
while [ "$lastId" != "null" ]; do | |
result=$(curl -s "$nodeUrl/namespace/root/page?pageSize=100&id=$lastId") | |
firstId=$(echo $result | jq .data[0].meta.id) | |
lastId=$(echo $result | jq .data[-1].meta.id) | |
[ "$lastId" = "null" ] && break | |
echo $result | jq '.data[].namespace' > "$tempDir/$firstId.json" | |
sleep 1 | |
done | |
jq --slurp '.' $tempDir/*.json > namespaces.json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment