2016-08-22 15 views
0

我怎樣才能找出各種SoftLayer服務的輸入內容?如何確定如何調用Sotlayer服務API

https://sldn.softlayer.com/reference/services/SoftLayer_Network_Storage_Group/getAttachedVolumes

我知道如何創建對象調用這些命令,但目前還不清楚該怎麼傳遞到這些API引用。我是否缺少某種文檔或者是否有一種獨立的方式來解決它?

到目前爲止,我基本上都在猜測,看着管理人員如何調用相關函數,但在這種情況下,沒有經理使用這種服務或特定功能。

+0

在這種情況下,您需要查看所需的頭文件,在這種情況下,文檔中提到:initParameter和autenticación。初始參數基本上是您想要獲取,編輯或刪除的對象的ID。使用python你pasa這樣的id:clent.getAttachedVolumes(id = 111)問候。 –

回答

1

我想你使用python,看看這個腳本getAttachedVolumes看着經理:

""" 
This script retrieve the network storage volumes this group is attached to 

Important manual pages: 
https://sldn.softlayer.com/reference/services/SoftLayer_Network_Storage_Group/getAttachedVolumes 
https://sldn.softlayer.com/reference/datatypes/SoftLayer_Network_Storage 

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

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

storageGroupId = 448757 
# declaring the API client 
client = SoftLayer.Client(username=USERNAME, api_key=API_KEY) 

try: 
    result = client['SoftLayer_Network_Storage_Group'].getAttachedVolumes(id=storageGroupId) 
    pprint.pprint(result) 
except SoftLayer.SoftLayerAPIError as e: 
    print(('Error faultCode=%s, faultString=%s' 
    % (e.faultCode, e.faultString))) 

我希望它能夠提供一種思路如何發送輸入的方法,你應該送的此lineL

客戶[ 'SoftLayer_Network_Storage_Group']。getAttachedVolumes(ID = storageGroupId)

看看下面的鏈接獲得更多信息:

另一個重要的環節:

對於其他編程語言:

請讓我知道如果你需要與其他方法,編程語言進一步的援助或懷疑它。

更新

要檢索帳戶的網絡存儲組(與它們的標識符),您可以使用此方法:在Python SoftLayer_Account::getNetworkStorageGroups,下面的例子:

""" 
This script retrieves an account's Network Storage Groups 

Important manual pages: 
http://sldn.softlayer.com/reference/services/SoftLayer_Account/getNetworkStorageGroups 
http://sldn.softlayer.com/reference/datatypes/SoftLayer_Network_Storage_Group 

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

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

# declaring the API client 
client = SoftLayer.Client(username=USERNAME, api_key=API_KEY) 

try: 
    result = client['SoftLayer_Account'].getNetworkStorageGroups() 
    pprint.pprint(result) 
except SoftLayer.SoftLayerAPIError as e: 
    print(('Error faultCode=%s, faultString=%s' 
    % (e.faultCode, e.faultString))) 

你將在響應中檢索標識符(groupId

+0

在這裏很好的迴應,雖然我沒有看到很多團體。你會知道如何獲得groupID嗎? – Recurrsion

+0

我的歉意,我忘了附上腳本來獲取NetworkStorageGroups,請參閱我的回覆**更新**部分。請讓我知道你是否有任何疑問或問題 –