2016-04-12 16 views
0

将来、特定の日付にSoftLayerデバイスをキャンセルしたいとお考えの場合、SoftLayer_Billing_Item_Cancellation_Request::createObjectが見つかりました。SoftLayer REST APIキャンセルリクエスト

request urlは何が好きで見て、私はJSONを使用した場合のようなPOST parameters表情は希望でしょうか?

おかげ

答えて

0

これは残りの一例ですが、あなたを助けることができる:

Cancel Service - rest

を課金アイテムを取得するには、以下を参照してください。

SoftLayer_Virtual_Guest::getBillingItem

をまた、これは、Pythonで例:

""" 
Cancel a Virtual Guest. 
It cancels the resource for a billing Item. The billing item will be cancelled 
immediately and reclaim of the resource will begin shortly. 

Important manual pages: 
http://sldn.softlayer.com/reference/services/SoftLayer_Virtual_Guest/getObject 
http://sldn.softlayer.com/reference/services/SoftLayer_Billing_Item/cancelService 

License: http://sldn.softlayer.com/article/License 
Author: SoftLayer Technologies, Inc. <[email protected]> 
""" 
import SoftLayer.API 
from pprint import pprint as pp 

# Your SoftLayer API username and key. 
API_USERNAME = 'set me' 

# Generate one at https://control.softlayer.com/account/users 
API_KEY = 'set me' 

virtualGuestId = 9923645 

client = SoftLayer.Client(
    username=API_USERNAME, 
    api_key=API_KEY, 
) 

try: 
    # Getting the billing item id 
    mask = 'mask.billingItem.id' 
    cci = client['SoftLayer_Virtual_Guest'].getObject(mask=mask, id=virtualGuestId) 
    billingItemId = cci['billingItem']['id'] 

    try: 
     # Canceling the Virtual Guest 
     result = client['Billing_Item'].cancelService(id=billingItemId) 
     pp(result) 
    except SoftLayer.SoftLayerAPIError as e: 
     pp('Unable to cancel the VSI faultCode=%s, faultString=%s' 
      % (e.faultCode, e.faultString)) 

except SoftLayer.SoftLayerAPIError as e: 
     pp('Unable to get the billing item id from VSI faultCode=%s, faultString=%s' 
      % (e.faultCode, e.faultString)) 

はまた、他のクライアントで多くの例があなたを助けることができますがあります。

Cancel Service - rest

Cancel service - Python

cancel service - php

cancel service-perl

参照

SoftLayer_Billing_Item::cancelService

SoftLayer_Virtual_Guest::getBillingItem

SoftLayer_Virtual_Guest::getObject

+0

これは私がやろうとしたことではありません。私は将来、仮想デバイスをいつか取り消したいと思っています。つまり、ある種の日付/時刻オブジェクトをリクエストに添付する必要があります。 SoftLayerのようなものがありますか? – juls85

0

これはあなたが何を探していることがあります。

Post URL: https://api.softlayer.com/rest/v3.1/SoftLayer_Billing_Item_Cancellation_Request/createObject.json 

Payload: 

{ 
    "parameters": [ 
     { 
      "complexType": "SoftLayer_Billing_Item_Cancellation_Request", 
      "accountId": 321752, 
      "notes": "No notes provided", 
      "items": [ 
       { 
        "complexType": "SoftLayer_Billing_Item_Cancellation_Request_Item", 
        "billingItemId": 25849466, 
        "scheduledCancellationDate": "5/15/2006" 
       } 
      ] 
     } 
    ] 
} 

私はそれが

よろしく

を役に立てば幸い
+0

ありがとう、それは私が必要なもののように見えます:) – juls85

+0

偉大な最高の答えとしてマークすることを忘れないでください。 –

+0

これとリクエストの少し異なるバージョンが私にとってうまくいきません。 – juls85

関連する問題