Added support for Delete Contact
This commit is contained in:
parent
0c80def5d0
commit
6c982f94cc
@ -12,18 +12,12 @@ read -r CONTATCS
|
|||||||
|
|
||||||
if [ "$CONTATCS" = "1" ]
|
if [ "$CONTATCS" = "1" ]
|
||||||
then
|
then
|
||||||
echo "WIP"
|
|
||||||
sleep 2
|
|
||||||
source conactsmenu.sh
|
|
||||||
source listcontacts.sh
|
source listcontacts.sh
|
||||||
elif [ "$CONTATCS" = "2" ]
|
elif [ "$CONTATCS" = "2" ]
|
||||||
then
|
then
|
||||||
source addcontact-menu.sh
|
source addcontact-menu.sh
|
||||||
elif [ "$CONTATCS" = "3" ]
|
elif [ "$CONTATCS" = "3" ]
|
||||||
then
|
then
|
||||||
echo "WIP"
|
|
||||||
sleep 2
|
|
||||||
source conactsmenu.sh
|
|
||||||
source deletecontact.sh
|
source deletecontact.sh
|
||||||
elif [ "$CONTATCS" = "4" ]
|
elif [ "$CONTATCS" = "4" ]
|
||||||
then
|
then
|
||||||
|
17
deletecontact.sh
Normal file
17
deletecontact.sh
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
|
||||||
|
|
||||||
|
printf "Enter Contact ID: "
|
||||||
|
read -r CONATACT_ID
|
||||||
|
DELETESUCCESS=$(curl -s -b $COOKIE $BML_URL/contacts/$CONATACT_ID \
|
||||||
|
--data-raw _method=delete \
|
||||||
|
--compressed \
|
||||||
|
| jq -r .code)
|
||||||
|
|
||||||
|
if [ "$DELETESUCCESS" = "0" ]
|
||||||
|
then
|
||||||
|
echo Contact Deleted
|
||||||
|
source contactsmenu.sh
|
||||||
|
else
|
||||||
|
echo "${red}There was an error${reset}"
|
||||||
|
source contactsmenu.sh
|
||||||
|
fi
|
@ -1,3 +1,3 @@
|
|||||||
curl -s -b $COOKIE $BML_URL/contacts \
|
curl -s -b $COOKIE $BML_URL/contacts \
|
||||||
| jq -r '["Account Number","Currency","Account Name","Contact Name"], ["==================================================================="], (.["payload"] | .[] | [.account, .currency, .name, .alias]) | @tsv'
|
| jq -r '["ID","Account Number","Currency","Account Name","Contact Name"], ["==================================================================="], (.["payload"] | .[] | [.id, .account, .currency, .name, .alias]) | @tsv'
|
||||||
source contactsmenu.sh
|
source contactsmenu.sh
|
||||||
|
@ -3,7 +3,7 @@ then
|
|||||||
source $CREDENTIALS
|
source $CREDENTIALS
|
||||||
if [ "$LOGIN" = "2" ]
|
if [ "$LOGIN" = "2" ]
|
||||||
then
|
then
|
||||||
echo "${red}Password update required${reset}"
|
echo "${red}Login Required${reset}"
|
||||||
rm $CREDENTIALS 2> /dev/null
|
rm $CREDENTIALS 2> /dev/null
|
||||||
read -p 'Username: ' BML_USERNAME
|
read -p 'Username: ' BML_USERNAME
|
||||||
read -s -p 'Password: ' BML_PASSWORD
|
read -s -p 'Password: ' BML_PASSWORD
|
||||||
@ -13,7 +13,7 @@ then
|
|||||||
fi
|
fi
|
||||||
elif [ ! -f $CREDENTIALS ]
|
elif [ ! -f $CREDENTIALS ]
|
||||||
then
|
then
|
||||||
echo "${red}Username or Password in correct${reset}"
|
echo "${red}Login Required${reset}"
|
||||||
read -p 'Username: ' BML_USERNAME
|
read -p 'Username: ' BML_USERNAME
|
||||||
read -s -p 'Password: ' BML_PASSWORD
|
read -s -p 'Password: ' BML_PASSWORD
|
||||||
echo ""
|
echo ""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user