ovh-api-bash-client/samples/list-domains.sh

21 lines
424 B
Bash
Raw Normal View History

#!/usr/bin/env bash
HERE=$(dirname "${BASH_SOURCE[0]}")
source ${HERE}/../ovh-api-lib.sh || exit 1
OvhRequestApi "/me"
if [ "${OVHAPI_HTTP_STATUS}" != "200" ]; then
echo "profile error:"
echo ${OVHAPI_HTTP_RESPONSE}
exit
fi
OvhRequestApi "/domain"
if [ ${OVHAPI_HTTP_STATUS} -eq 200 ]; then
domains=$(getJSONValues "${OVHAPI_HTTP_RESPONSE}")
for domain in ${domains}
do
echo "- ${domain}"
done
fi