0

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>
user921176
  • 91
  • 1
  • 12
  • The question is a duplicate, already answered [here](http://stackoverflow.com/questions/41997010/objectfilter-in-softlayer-doesnt-work?rq=1) – user921176 Apr 12 '17 at 06:18

3 Answers3

2

Try this object filter

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

Regards

ann
  • 36
  • 1
  • This answer would benefit everyone greately if you explained ***why?*** SO is a place to help people get to the answer. – AP. Apr 12 '17 at 16:22
  • What dazzles me is that such an expensive product has such a poor API, poor examples, and poor documentation – user921176 Apr 13 '17 at 10:59
0

I think this filter is the one which work

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

-1

Review this link:

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

Community
  • 1
  • 1