我使用salesforce REST API来检索所有帐户。像这样:
..."/query?q=select+name,+cust_number__c,+cust_status__c+from+account+where+cust_number__c+!=null"
我需要每天检索一次delta记录。所以我打算使用' lastmodifiedDate'。检索lastmodifiedDate大于上次拉动的任何记录。但是我收到了一个错误
.../query?q=select+name,+CreatedDate+,+lastmodifiedDate,+cust_number__c,+cust_status__c+from+account+where+lastmodifiedDate+%3e+2017-04-03T20:12:37.000+0000;
Query was unsuccessful. Status code returned is 400
An error has occured. Http status: 400
[ {
"message" : "\nlastmodifiedDate > 2017-04-03T20:12:37.000 0000\n ^\nERROR at Row:1:Column:159\nline 1:159 no viable alternative at character ' '",
"errorCode" : "MALFORMED_QUERY"
} ]
当我尝试这个查询时:
.../query?q=select+name,+CreatedDate+,+lastmodifiedDate,+cust_number__c,+cust_status__c+from+account+where+lastmodifiedDate+>+2017-04-03T20:12:37.000+0000;
Query URL: Exception in thread "main" java.lang.IllegalArgumentException: Illegal character in query at index 190:
Exception for '>'
如何在where子句中获得带日期的结果?
由于
答案 0 :(得分:0)
我必须编码' +'在时间也是如此。所以最后的查询是
.../query?q=select+name,+CreatedDate+,+lastmodifiedDate,+cust_number__c,+cust_status__c+from+account+where+lastmodifiedDate+%3e+2017-04-03T20:12:37.000+0000