cURL Sample – GetRestAPIVersionInfo.sh for Profitability and Cost Management

Common functions: See Profitability and Cost Management Common Helper Functions for cURL

 funcGetRestAPIVersionInfo()
{
	url=$SERVER_URL/epm/rest/$API_VERSION
	funcExecuteRequest "GET" $url "application/x-www-form-urlencoded"
	status=$?
	echo "status code :$status"
	output='cat response.txt'
	if [ $status == 200 ]; then
		echo "Version $API_VERSION details :"
		count='echo $output | jq '.links | length''
		i=0
		while [ $i -lt $count ]; do
			echo "Service : " 'echo $output | jq '.links['$i'].rel''
			echo "URL :" 'echo $output | jq '.links['$i'].href''
			echo "Action :" 'echo $output | jq '.links['$i'].action''
			echo ""
			i='expr $i + 1'
		done
	else
		error='echo $output'
		echo "Error occurred. " $error
	fi
	funcRemoveTempFiles "respHeader.txt" "response.txt"
}