How to use object filter with softlayer rest api?

后端 未结 1 800
再見小時候
再見小時候 2020-11-30 13:32

I read this article and have some problems trying to follow the examples. The following is one of the examples given in that article. The first parameter in the object filte

相关标签:
1条回答
  • 2020-11-30 13:44

    Try to follow these recomendations: Getting first parameter through Service Datatype or How to define the first parameter as simple way?


    Getting first parameter through Service Datatype

    You are trying to get

    • SoftLayer_Account::getBlockDeviceTemplateGroups

    As you see, you are using SoftLayer_Account service, you need to open its datatype from this service:

    • You can go here: http://sldn.softlayer.com/reference/services/SoftLayer_Account and click on "datatypes" label/option
    • Or go directly here: SoftLayer_Account

    So, you need to start here, the method that you are using is getBlockDeviceTemplateGroups, if you want to get this information in the datatypes, you should skip the word "get" and looking for "BlockDeviceTemplateGroups" property, so you will have the correct parameter that you need to set at first.


    How to define the first parameter as simple way?

    If you notice, the only changes were: skip "get" word from the method, in this case is "getBlockDeviceTemplateGroups", so it will be:

    "BlockDeviceTemplateGroups"

    The next step should be set the first char in lowercase like:

    "blockDeviceTemplateGroups"

    So, it should be the filter:

    object_filter = {
    'blockDeviceTemplateGroups': {
        'datacenter': {
            'name': {'operation': 'dal05'}
            }
        }
    }
    

    References:

    • Object Filters
    • Going Further with the SoftLayer API Python Client - Part 1
    0 讨论(0)
提交回复
热议问题