How to cancel SoftLayer order for Block Storage?

2019-07-02 14:24发布

问题:

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?

回答1:

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



回答2:

Basically to cancel a device in softlayer you need to cancel the billing item, to cancel the billing item you can use these methods: http://sldn.softlayer.com/reference/services/SoftLayer_Billing_Item/cancelItem http://sldn.softlayer.com/reference/services/SoftLayer_Billing_Item_Cancellation_Request/createObject

A endurance Blog storage is a Network storage object so to get the billing item you can use http://sldn.softlayer.com/reference/services/SoftLayer_Network_Storage/getBillingItem

and to get all network storages in your device you can use http://sldn.softlayer.com/reference/services/SoftLayer_Account/getNetworkStorage

Regards