2016-04-12 28 views
0

İleride belirli bir tarihte bir SoftLayer cihazını iptal etmek istiyorum ve şu SoftLayer_Billing_Item_Cancellation_Request::createObject numaralı telefonu buldum.SoftLayer REST API İptal İsteği

request url neye benziyordu ve json kullanıyor olsaydım POST parameters neye benziyordu?

Teşekkür

cevap

0

Bu istirahat örnek size yardımcı olabilir edilir:

Cancel Service - rest

fatura öğeyi almak için, bakın:

Ayrıca SoftLayer_Virtual_Guest::getBillingItem

, bu bir Python olduğunu örnek:

""" 
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)) 

Ayrıca diğer müşteriler çok örnekler size yardımcı olabilir vardır:

Cancel Service - rest

Cancel service - Python

cancel service - php

cancel service-perl

Kaynaklar

SoftLayer_Billing_Item::cancelService

SoftLayer_Virtual_Guest::getBillingItem

SoftLayer_Virtual_Guest::getObject

+0

Bu, yapmaya çalıştığım şey değil. Gelecekte bir sanal cihazı iptal etmek istiyorum, yani bir çeşit tarih/saat nesnesini isteğime eklemem gerekecek. SoftLayer için böyle bir şey var mı? – juls85

0

Bu ne arıyorsun edilebilir:

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" 
       } 
      ] 
     } 
    ] 
} 

Ben

Selamlar

yardımcı olur umarım
+0

Teşekkür ederim, ihtiyacım olana benziyor :) – juls85

+0

En iyi cevap olarak işaretlemeyi unutmayın. –

+0

Bu ve İstek'in biraz farklı bir sürümü benim için çalışmıyor. – juls85