当我使用不存在的标记在api https://api.softlayer.com/mobile/v3.1/中列出VSI时。服务器返回200 {"error":"Internal Error","code":"SoftLayer_Exception_Public"}
。
通常,服务器应返回200 []
。如果响应中有错误,则返回码不应为200。
这是详细信息:
2018/10/19 10:33:59 [DEBUG]请求URL:GET https://api.softlayer.com/mobile/v3.1/SoftLayer_Account/getVirtualGuests.jsonobjectFilter=%7B%22virtualGuests%22%3A%7B%22tagReferences%22%3A%7B%22tag%22%3A%7B%22name%22%3A%7B%22operation%22%3A%22in%22%2C%22options%22%3A%5B%7B%22name%22%3A%22data%22%2C%22value%22%3A%5B%5B%22not_exist_tag%22%5D%5D%7D%5D%7D%7D%7D%7D%7D&objectMask=mask%5Bid%2C+globalIdentifier%2C+hostname%2C+hourlyBillingFlag%2C+domain%2C+fullyQualifiedDomainName%2C+status.name%2C+powerState.name%2C+activeTransaction%2C+datacenter.name%2C+account.id%2C+maxCpu%2C+maxMemory%2C+primaryIpAddress%2C+primaryBackendIpAddress%2C+privateNetworkOnlyFlag%2C+dedicatedAccountHostOnlyFlag%2C+createDate%2C+modifyDate%2C+billingItem%5BorderItem%5Bid%2Corder.userRecord%5Busername%5D%5D%2C+recurringFee%5D%2C+notes%2C+tagReferences.tag.name%5D&resultLimit=0%2C100 2018/10/19 10:33:59 [DEBUG]参数: 2018/10/19 10:34:01 [DEBUG]状态码:200 2018/10/19 10:34:01 [DEBUG]响应:{“错误”:“内部错误”,“代码”:“ SoftLayer_Exception_Public”}
答案 0 :(得分:0)
您得到的错误是因为您在对象过滤器的“值”属性中使用了双括号。
我建议您使用以下示例:
"value":["not_exist_tag"]
或者您可以尝试使用以下rest api调用:
https://[username]:[apiKey]@api.softlayer.com/rest/v3.1/SoftLayer_Account/getVirtualGuests.json?objectFilter={"virtualGuests":{"tagReferences":{"tag":{"name":{"operation":"in","options":[{"name":"data","value":["not_exist_tag"]}]}}}}}
“内部错误”的状态码不应为200,这是一个SoftLayer api问题,已经报告过。