1

我正在尝试过滤掉我的list of images by OS reference code. 这是我正在尝试的网址:

https://api.softlayer.com/rest/v3/SoftLayer_Account/getBlockDeviceTemplateGroups.json?objectMask=mask[flexImageFlag]&objectFilter={'children': {'blockDevices': {'diskImage': {'softwareReferences': {'softwareDescription': {'referenceCode': {'operation': 'REDHAT_6_64'}}}}}}}

但我不断收到以下错误消息:

{"error":"Unable to parse object filter.","code":"SoftLayer_Exception_Public"}

谁能帮我看看有什么问题?提前致谢!

QZ

4

2 回答 2

1

过滤器是错误的,但在我的测试中,过滤器不适用于“referenceCode”属性;您需要使用其他属性,例如名称、版本或两者。请参阅下面的示例:

使用名称和版本属性

https://api.softlayer.com/rest/v3/SoftLayer_Account/getBlockDeviceTemplateGroups?objectMask=mask[flexImageFlag]&objectFilter={"blockDeviceTemplateGroups": {"children":{"blockDevices":{"diskImage":{"softwareReferences":{"softwareDescription":{"name":{"operation":"CentOS"}, "version":{"operation":"6.3-32"}}}}}}}}

仅使用一个属性(在本例中为名称)

https://api.softlayer.com/rest/v3/SoftLayer_Account/getBlockDeviceTemplateGroups?objectMask=mask[flexImageFlag]&objectFilter={"blockDeviceTemplateGroups": {"children":{"blockDevices":{"diskImage":{"softwareReferences":{"softwareDescription":{"name":{"operation":"CentOS"}}}}}}}}

问候

于 2015-11-17T17:13:59.513 回答
0

看起来您正在使用 REST api。API 参考中的示例 建议此参数应为 JSON 格式:

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

您的错误显示“无法解析对象过滤器。”,因此错误可能只是您的参数无效 JSON:JSON 标准只接受双引号。

尝试更换

{'children': {'blockDevices': {'diskImage': {'softwareReferences': {'softwareDescription': {'referenceCode': {'operation': 'REDHAT_6_64'}}}}}}}

使用相应的有效 json:

{"children": {"blockDevices": {"diskImage": {"softwareReferences": {"softwareDescription": {"referenceCode": {"operation": "REDHAT_6_64"}}}}}}}

于 2015-11-17T17:11:21.590 回答