如何将对象过滤器与 softlayer rest api 一起使用? [英] How to use object filter with softlayer rest api?

查看:19
本文介绍了如何将对象过滤器与 softlayer rest api 一起使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我阅读了

<小时>

如何以简单的方式定义第一个参数?

如果您注意到,唯一的变化是:从方法中跳过get"字样,在本例中是getBlockDeviceTemplateGroups",因此它将是:><块引用>

BlockDeviceTemplateGroups"

下一步应该将第一个字符设置为小写,例如:

<块引用>

blockDeviceTemplateGroups"

所以,应该是过滤器:

object_filter = {'blockDeviceTemplateGroups':{'数据中心': {'名称':{'操作':'dal05'}}}}

参考:

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 filter is virtualGuests. This object filter can be used in api https://api.softlayer.com/rest/v3/SoftLayer_Account/VirtualGuests.

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

I want to use the object filter in other api methods, like SoftLayer_Account/getBlockDeviceTemplateGroups for example. My question is how to get/set the first parameter like virtualGuests? I tried several times but failed.

解决方案

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

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

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:

这篇关于如何将对象过滤器与 softlayer rest api 一起使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆