-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate-user.sh
executable file
·48 lines (40 loc) · 1.39 KB
/
create-user.sh
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
46
47
48
# Script to replicate the issue with Docebo on the production instance
# Token generated via /oauth2/token
DOCEBO_ACCESS_TOKEN=$1
# Docebo base API URL
DOCEBO_API_URL=https://makerbotecs.docebosaas.com/api # Reproduces issue
#DOCEBO_API_URL=https://university.makerbot.com/api # Reproduces issue
#DOCEBO_API_URL=https://makerbotsandbox.docebosaas.com/api # Does not reproduce issue
# Index of additional field to add for user
FIELD_NUM=242 # Note that it doesn't reproduce for certain field numbers (#1 did not work)
COOKIE_JAR=./cookie-jar.tmp
if [ -z ${DOCEBO_ACCESS_TOKEN} ]; then
echo Please enter Docebo access token
exit;
fi
# Create user without cookie header (none already exist)
# Does not persist additional fields
curl -vi -X POST \
$DOCEBO_API_URL/user/create \
-H "Authorization: Bearer $DOCEBO_ACCESS_TOKEN" \
-H 'Content-Type: application/json' \
-d "{
\"userid\": \"docebo-test-create-user-no-cookie\",
\"fields\": {
\"$FIELD_NUM\": \"test\"
}
}" \
-c $COOKIE_JAR # Cookie is persisted here
# Create user with cookie header from the cookie jar file
# Persists the additional fields
curl -vi -X POST \
$DOCEBO_API_URL/user/create \
-H "Authorization: Bearer $DOCEBO_ACCESS_TOKEN" \
-H 'Content-Type: application/json' \
-d "{
\"userid\": \"docebo-test-create-user-with-cookie\",
\"fields\": {
\"$FIELD_NUM\": \"test\"
}
}" \
-b $COOKIE_JAR