Skip to content

REST API Usage Examples

griggheo edited this page Oct 14, 2010 · 5 revisions

The following environment variables are assumed to have proper values:

USER=“your Overmind username”
PASS=“your Overmind password”
OVERMIND_IP=“IP address of server where Overmind is running”
OVERMIND_PORT=“port number where Overmind is running”

Provider operations

Listing all providers

curl --user $USER:$PASS http://${OVERMIND_IP}:${OVERMIND_PORT}/api/providers/

Creating an EC2 provider

EC2_ACCESS_ID=“your EC2 access id”
EC2_SECRET_KEY=“your EC2 secret key”
PROVIDER_TYPE=“EC2_US_EAST” or “EC2_US_WEST” or “EC2_EU_WEST”
NAME=“my_new_EC2_provider_name”

curl --user $USER:$PASS -i -H "Accept: application/json" -X POST -d "name=$NAME&provider_type=$PROVIDER_TYPE&access_key=$EC2_ACCESS_ID&secret_key=$EC2_SECRET_KEY" http://${OVERMIND_IP}:${OVERMIND_PORT}/api/providers/

Node operations

Listing all non-decommissioned nodes

curl --user $USER:$PASS http://${OVERMIND_IP}:${OVERMIND_PORT}/api/nodes/

Listing all nodes, including decommissioned nodes

curl --user $USER:$PASS http://${OVERMIND_IP}:${OVERMIND_PORT}/api/nodes/?show_decommissioned=true

Creating a node for an EC2 provider

PROVIDER_ID=1 (this will vary based on your specific case; list your providers first to see which ID you need)
NAME=‘test_api_node’
REALM_ID=0
FLAVOR_ID=“m1.small”
IMAGE_ID=“ami-00194945”

curl --user $USER:$PASS -i -H "Accept: application/json" -X POST -d "provider_id=$PROVIDER_ID&name=$NAME&realm=$REALM_ID&flavor=$FLAVOR_ID&image=$IMAGE_ID" http://${OVERMIND_IP}:${OVERMIND_PORT}/api/nodes/

Deleting a node

NODE_ID=node_id_of_node_you_want_to_delete

curl --user $USER:$PASS -i -H "Accept: application/json" -X DELETE http://${OVERMIND_IP}:${OVERMIND_PORT}/api/nodes/$NODE_ID