Softlayer filtering not working

让人想犯罪 __ 提交于 2019-12-12 03:29:01

问题


Why is filtering not working as defined in Softlayer API filtering documentation?

Here is the REST call to the API with filtering:

https://api.softlayer.com/rest/v3/SoftLayer_Account/getVirtualGuests?objectMask=mask[id,datacenter]&objectFilter={"datacenter":{"name":{"operation":"dal05"}}}

And this wont work. It returns virtual hosts from any datacenter, NOT from dal05 ONLY as expected:

<root>
  <item>
    <id>24291415</id>
    <datacenter>
       <id>814994</id>
       <longName>Amsterdam 3</longName>
       <name>ams03</name>
       <statusId>2</statusId>
    </datacenter>
  </item>
  <item>
    <id>26248749</id>
    <datacenter>
      <id>814994</id>
      <longName>Amsterdam 3</longName>
      <name>ams03</name>
      <statusId>2</statusId>
    </datacenter>
  </item>
  <item>
    <id>26248751</id>
    <datacenter>
      <id>814994</id>
      <longName>Amsterdam 3</longName>
      <name>ams03</name>
      <statusId>2</statusId>
    </datacenter>
  </item>
</root>

回答1:


Try this object filter

objectFilter={"virtualGuests":{"datacenter":{"name":{"operation":"dal05"}}}}

Regards




回答2:


I think this filter is the one which work

objectFilter={"virtualGuests":{"datacenter":{"name":{"operation":"dal05"}}}}




回答3:


Review this link:

  • How to use object filter with softlayer rest api?

it will provide a clear idea about how to define object filters



来源:https://stackoverflow.com/questions/43361347/softlayer-filtering-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!