Well, this one is a bit cheeky because I borrowed it from a colleague of mine David Coon. Thanks David, I appreciate your assistance!
#!/bin/bash auth() { read -p "What is your Account Number: " ddi read -p "Whats your username:" username read -p "Whats your APIkey:" APIkey read -p "Which Datacenter are your servers in? " dc } token() { token=`curl -s https://identity.api.rackspacecloud.com/v2.0/tokens -X POST \ -d '{"auth":{"RAX-KSKEY:apiKeyCredentials":{"username":"'$username'", "apiKey":"'$APIkey'"}}}' \ -H "Content-Type: application/json" | python -m json.tool | sed -n '/expires/{n;p;}' |sed -e 's/^.*"id": "\(.*\)",/\1/'` echo "Your API Token is ----> $token" } listservers() { curl -s -H "X-Auth-Token: $token" "https://$dc.servers.api.rackspacecloud.com/v2/$ddi/servers" | python -m json.tool } getservers() { read -p "What is the server id?" id curl -s -H "X-Auth-Token: $token" "https://$dc.servers.api.rackspacecloud.com/v2/$ddi/servers/$id" | python -m json.tool } auth token listservers getservers