如何弄清楚如何调用Sotlayer Service API

时间:2016-08-22 20:38:33

标签: ibm-cloud-infrastructure

我怎样才能找出传递给各种SoftLayer服务的输入?

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

我知道如何创建调用这些命令的对象,但是不清楚要传递给这些API引用的内容。我错过了某种文档,还是有一种独立的方法来解决它?

到目前为止,我基本上一直在猜测管理者如何调用相关函数,但在这种情况下,没有经理使用此服务或特定功能。

1 个答案:

答案 0 :(得分: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. <sldn@softlayer.com>
"""
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)))

我希望它能提供一个如何发送方法输入的想法,你应该发送这个行L

  

客户端[#39&; SoftLayer_Network_Storage_Group&#39;] getAttachedVolumes(ID = storageGroupId)

查看以下链接以获取更多信息:

另一个重要的链接:

对于其他编程语言:

如果您需要有关其他方法,编程语言或疑问的进一步帮助,请与我们联系。

  

<强>更新

要检索帐户的网络存储组(及其标识符),您可以使用以下方法:SoftLayer_Account::getNetworkStorageGroups,在python中的示例下方:

"""
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. <sldn@softlayer.com>
"""
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