2016-03-02 68 views
0

我使用其余API获取创建日期大于某个日期的发票(例如:2015年9月1日之后)。Inovice的对象过滤器创建日期

GET 
https://{{sluser}}:{{slkey}}@api.softlayer.com/rest/v3.1/SoftLayer_Account/getInvoices?objectFilter={"createDate":{"operation":"greaterThanDate","options":[{"name":"date", "value":"10/01/2015"}]}}&resultLimit=1,5 

但这似乎是给出前5个发票。我现在可能在objectFilter中出了什么问题?另外我怎样才能指定日期格式dd-MM-YYYYmm-dd-yyyyyyyy-mm-dd

回答

1

试试下面的REST请求:

https://[username]:[apikey] @api.softlayer.com/rest/v3/SoftLayer_Account/getInvoices?objectFilter={ "invoices": {  "createDate": {  "operation": "greaterThanDate",  "options": [   {   "name": "date",   "value": [    "01/22/2016"   ]   }  ]  } } }&objectMask=mask[createDate] 
Method: GET 

其中:date formatmm-dd-yyyy

这是使用“betweenDate”另一个例子:

https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Account/getInvoices?objectFilter={ "invoices": {  "createDate": {  "operation": "betweenDate",  "options": [   {   "name": "startDate",   "value": ["02/01/2014"]   },   {   "name": "endDate",   "value": ["02/13/2014"]  }  ]  } } }&objectMask=mask[createDate] 
Method: GET 

参考文献:

Object Filters

More SoftLayer REST API Examples

+0

我会删除这个答案的引用。第一个显示的值是一个字符串,而不是一个字符串的数组。没有澄清差异使查找参考混淆。第二个指向其他使用过滤器的例子,但没有一个使用日期过滤器。不过,您可以在https://softlayer.github.io/ruby/getNotifications/和https://softlayer.github.io/python/notifications/上看到此答案中使用的表单示例。 – renier