/v3/SoftLayer_Account/getObject.json REST 端点正在为我返回一个空响应
/v3/SoftLayer_Account/getObject.json REST endpoint is returning an empty response for me
此 REST 调用 returns 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
其他主账户return 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
错误是由于您的帐户有大量发票(大约 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 将不起作用
此致
此 REST 调用 returns 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
其他主账户return 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
错误是由于您的帐户有大量发票(大约 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 将不起作用
此致