Search code examples
ibm-cloud-infrastructure

How to cancel SoftLayer order for Block Storage?


I was finally able to use SoftLayer services API to order an Endurance block storage. Now, the question is how can I cancel it using the API? Which data that I need from the order that I need to use to cancel? And what API do I use to cancel?

I have the SoftLayer_Billing_Order and SoftLayer_Billing_Item information. For a Virtual server, from above info, a guestId or hardwareId is used to identify the server and use it to delete. I don't get such data for the storage. They are empty.

So how do I reference an endurance block storage that I provisioned? And how do I cancel or delete it using the SoftLayer Services APIs?


Solution

  • To cancel an Endurance Block Storage, execute:

    https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Billing_Item/[billing_item_id]/cancelService
    

    Method: GET

    Reference: http://sldn.softlayer.com/reference/services/SoftLayer_Billing_Item/cancelService

    Additional requests:

    How to get the billing_item_id?

    Execute:

    https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Network_Storage/[network_storage_id]/getObject.json?objectMask=mask[id,username,billingItem.id]
    

    Method: GET

    Reference:http://sldn.softlayer.com/reference/services/SoftLayer_Network_Storage/getObject

    How to get the network_storage_id?

    Execute:

    If we know the name assigned to the Endurance, we can use filters to get this specific item: e.g. username: SL01SEL123456-1

    https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Account/getNetworkStorage?objectFilter={"networkStorage":{ "username":{"operation":"SL01SEL123456-1"}}}
    

    Method: GET

    Reference: http://sldn.softlayer.com/reference/services/SoftLayer_Account/getNetworkStorage