Fail to pass data in Curl POST command.
Code:
printf "\nGet given User details :\n"
curl -s -b ${COOKIE_FILE} -c ${COOKIE_FILE} 'https://api.xxxx.xxxx.com/sso/user?email='${USER_EMAIL} |python -m json.tool > output.txt
user_id=$(cat output.txt | grep -w "id" | awk -F ':' {'print $2'} | sed -e 's|[," ]||g');
echo "User ID for given add User: $user_id"
printf "\nGet given Role/Group details :\n"
curl -s -b ${COOKIE_FILE} -c ${COOKIE_FILE} 'https://api.xxxx.xxxx.com/role?name='${ROLE_NAME} | python -m json.tool > output_roles.txt
role_id=$(cat output_roles.txt | grep -w "id" | awk -F ':' {'print $2'} | sed -e 's|[," ]||g');
printf "\nAdding User to given Group :\n"
curl -s -b ${COOKIE_FILE} -c ${COOKIE_FILE} -X POST -data '{"role_users":"$role_id","user_roles":"$user_id"}' 'https://api.xxx.xxxx.com/rolesusers'
Curl POST Command is not working for me. Its not give me any error and no changes I see on application.
Curl command is working when I pass hard coded values.
curl -s -b ${COOKIE_FILE} -c ${COOKIE_FILE} -X POST -H "Accept: Application/json" -H "Content-Type: application/json" --data '{"role_users":22, "user_roles":99}' 'https://api.xxx.xxxx.com/rolesusers'