Skip to content

Instantly share code, notes, and snippets.

@greyhoundforty
Created April 12, 2016 19:33
Show Gist options
  • Save greyhoundforty/1d50388d4caff5b293c2f825ee63a7ca to your computer and use it in GitHub Desktop.
Save greyhoundforty/1d50388d4caff5b293c2f825ee63a7ca to your computer and use it in GitHub Desktop.
Order a Load Balancer

Get the Package ID

I am using the jt command line utility to parse the output

curl -sk "https://$SOFTLAYER_USERNAME:$SOFTLAYER_API_KEY@api.softlayer.com/rest/v3/SoftLayer_Product_Package/getAllObjects"| jt [ id % ] name %|grep Load
194	Load Balancers

Get the Price ID

Use Get Package Location Based price script to get the correct itemPriceId for the Datacenter we want to order in.

Create order.json file

{
    "parameters" : [
        {
            "packageId" : 194,
            "location" : 154820,
            "quantity" : 1,
            "prices": [
                {"id": 17234}
            ]
        }
    ]
}

Call the verifyOrder command to make sure the order will go through

curl -s --user "$SOFTLAYER_USERNAME:$SOFTLAYER_API_KEY" -X POST --data @lb.json "https://api.softlayer.com/rest/v3/SoftLayer_Product_Order/verifyOrder"

Complete the order with placeOrder

curl -s --user "$SOFTLAYER_USERNAME:$SOFTLAYER_API_KEY" -X POST --data @lb.json "https://api.softlayer.com/rest/v3/SoftLayer_Product_Order/placeOrder"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment