/v3/SoftLayer_Account/getObject.json REST端点为我返回一个空响应

时间:2016-06-04 00:24:35

标签: ibm-cloud-infrastructure

此REST调用返回200 OK但对某个主帐户的空响应:

curl -XGET -u UNAME:PASS https://api.softlayer.com/rest/v3/SoftLayer_Account/getObject.json?objectMask=filteredMask%5Binvoices%5Bid%2CcreateDate%2CtypeCode%5D%5D

其他主帐户返回json数据。我觉得在这里发布该主服务器的用户名并不舒服,但根据SoftLayer支持,Stack Overflow是一个可以联系到可以查看它的开发人员的地方。我显然对此表示怀疑但如果真的如此,那么#票是29250537。

我现在要适度节制。

更新1

结果限制设置为offset = 0,limit = 1适用于其他帐户但不适用于此帐户:

$ curl -vvv -u ... 'https://api.softlayer.com/rest/v3/SoftLayer_Account/getObject.json?objectMask=filteredMask%5Binvoices%5Bid%2CcreateDate%2CtypeCode%5D%5D&resultLimit=0,1'
*   Trying 66.228.119.120...
* Connected to api.softlayer.com (66.228.119.120) port 443 (#0)
* TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384
* Server certificate: api.softlayer.com
* Server certificate: RapidSSL SHA256 CA - G3
* Server certificate: GeoTrust Global CA
* Server auth using Basic with user '...'
> GET /rest/v3/SoftLayer_Account/getObject.json?objectMask=filteredMask%5Binvoices%5Bid%2CcreateDate%2CtypeCode%5D%5D&resultLimit=0,1 HTTP/1.1
> Host: api.softlayer.com
> Authorization: Basic ...
> User-Agent: curl/7.43.0
> Accept: */*
>
* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Date: Mon, 06 Jun 2016 14:35:51 GMT
< Server: Apache
< X-Frame-Options: SAMEORIGIN
< Vary: Accept-Encoding
< Content-Type: text/html; charset=UTF-8
< Connection: close
<
* Closing connection 0

1 个答案:

答案 0 :(得分:0)

错误是由于您的帐户有大量发票(大约31000),当您尝试获取如此大量的数据时,预计会出现此错误。为了避免此错误,您必须使用objectFilter或结果限制来过滤数据。

我建议你使用resultlimits试试这个请求:

GET https://api.softlayer.com/rest/v3/SoftLayer_Account/getInvoices.json?objectMask=filteredMask[id,createDate,typeCode]&resultLimit=0,5000

http://sldn.softlayer.com/article/object-filters https://sldn.softlayer.com/article/REST

试试这个卷曲

$ curl -XGET -u user:api "https://api.softlayer.com/rest/v3/SoftLayer_Account/getInvoices.json?objectMask=filteredMask%5Bid%2CcreateDate%2CtypeCode%5D&resultLimit=0%2C5000"

并注意到我正在使用getInvoices方法,如果您尝试使用getObjec方法,则resultlimmits将无效

此致