Created
December 25, 2019 00:50
-
-
Save muxator/b7913aa2957286ad2f8cf9a303dec6ef 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 | |
set -eu | |
set -o pipefail | |
PAD_NAME="shouldbepublic" | |
BASE_URL="http://localhost:9001" | |
APIKEY=$(<APIKEY.txt) | |
err_report() { | |
echo "Error on line $1" | |
} | |
trap 'err_report $LINENO' ERR | |
echo -ne "1. create a group: " | |
GROUP_ID=$(curl --silent "${BASE_URL}/api/1/createGroup?apikey=${APIKEY}" | jq --raw-output '.data.groupID') | |
echo -ne "GROUP_ID=${GROUP_ID}\n" | |
echo -ne "2. create a group pad inside that group: " | |
PAD_ID=$(curl --silent "${BASE_URL}/api/1/createGroupPad?apikey=${APIKEY}&groupID=${GROUP_ID}&padName=${PAD_NAME}" | jq --raw-output '.data.padID') | |
echo -ne "PAD_ID=${PAD_ID}\n" | |
echo -ne "3. set the public status of that pad to true: " | |
PUBLIC_STATUS_SUCCESS=$(curl --silent "${BASE_URL}/api/1/setPublicStatus?apikey=${APIKEY}&padID=${PAD_ID}&publicStatus=true" | jq --raw-output '.message') | |
echo -ne "${PUBLIC_STATUS_SUCCESS}\n" | |
GROUP_PAD_URL="${BASE_URL}/p/${PAD_ID}" | |
echo -ne "4. now visit ${GROUP_PAD_URL}\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment