mirror of
https://github.com/optim-enterprises-bv/databunker.git
synced 2025-10-29 17:12:22 +00:00
create user app
This commit is contained in:
@@ -1,6 +1,26 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -x
|
||||
DATABUNKER_APIKEY='1ca9a727-ee10-9cc6-c1a2-72da05951e69'
|
||||
|
||||
DATABUNKER_APIKEY='25ae59fb-3859-b807-7420-cdb83e089b42'
|
||||
curl -s http://localhost:3000/v1/user -XPOST "X-Bunker-Token: "$DATABUNKER_APIKEY -H "Content-Type: application/json" -d '{"name":"yul","email":"test@paranoidguy.com"}'
|
||||
echo "Creating user."
|
||||
RESULT=`curl -s http://localhost:3000/v1/user \
|
||||
-H "X-Bunker-Token: "$DATABUNKER_APIKEY -H "Content-Type: application/json" \
|
||||
-d '{"fname":"Test","lname":"Account","email":"test@paranoidguy.com","phone":"4444"}'`
|
||||
STATUS=`echo $RESULT | jq ".status" | tr -d '"'`
|
||||
if [ "$STATUS" == "error" ]; then
|
||||
echo "Error to create user, trying to lookup by email."
|
||||
RESULT=`curl -s http://localhost:3000/v1/user/email/test@paranoidguy.com -H "X-Bunker-Token: "$DATABUNKER_APIKEY`
|
||||
STATUS=`echo $RESULT | jq ".status" | tr -d '"'`
|
||||
fi
|
||||
if [ "$STATUS" == "error" ]; then
|
||||
echo "Failed to fetch user by email, got: $RESULT"
|
||||
exit
|
||||
fi
|
||||
|
||||
TOKEN=`echo $RESULT | jq ".token" | tr -d '"'`
|
||||
echo "User token is $TOKEN"
|
||||
|
||||
RESULT=`curl -s http://localhost:3000/v1/userapp/token/$TOKEN/shiping \
|
||||
-H "X-Bunker-Token: "$DATABUNKER_APIKEY -H "Content-Type: application/json" \
|
||||
-d '{"country":"Israel","address":"Allenby 1","postcode":"12345","status":"active"}' | jq ".status" | tr -d '"'`
|
||||
echo "User shiping record created, status $RESULT"
|
||||
Reference in New Issue
Block a user