-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathapi.scouting.org-command.sh
More file actions
46 lines (33 loc) · 1.29 KB
/
api.scouting.org-command.sh
File metadata and controls
46 lines (33 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env bash
# Check if authentication is set up
if [ -z "$TOKEN" ] || [ -z "$userId" ]; then
echo "Error: Authentication not set up. Please run:"
echo "export SCOUT_USERNAME=<username>"
echo "export SCOUT_PASSWORD=<password>"
echo "source config.sh"
exit 1
fi
# shellcheck disable=SC1091
source config.sh
# HTTPie doesnt support defining requests in a dedicated file, but we can still script it
CMD="http"
OPTS="--ignore-stdin"
# advancements/ranks
## get all ranks as a JSON object
"$CMD" "$OPTS" "$OPTIC_PROXY"/advancements/ranks
## ranks invalid parameter
"$CMD" "$OPTS" "$OPTIC_PROXY"/advancements/ranks\?foo
## rank requirements
"$CMD" "$OPTS" "$OPTIC_PROXY"/advancements/ranks/1/requirements
# advancements/youth
## authorization failure
"$CMD" "$OPTS" "$OPTIC_PROXY"/advancements/youth/123457890/
## not found
"$CMD" "$OPTS" "${OPTIC_PROXY}/advancements/youth/${userId}/" "Authorization: Bearer ${TOKEN}"
## method not allowed
"$CMD" "$OPTS" "${OPTIC_PROXY}/advancements/youth/${userId}" "Authorization: Bearer ${TOKEN}"
## leadership history
"$CMD" "$OPTS" "${OPTIC_PROXY}/advancements/youth/${userId}/leadershipPositionHistory" "Authorization: Bearer ${TOKEN}"
# data lookups
## get all countries as a JSON object
"$CMD" "$OPTS" "$OPTIC_PROXY"/lookups/address/countries