2016-03-02 67 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