How to set filter for DateSent for getMessages in Java using Twilio REST API

I am trying to get my message log using the REST api, but I cannot figure out how to filter the DateSent to be> = or <= than the date.

TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN); 
Map<String, String> filters = new HashMap<String, String>();
filters.put("DateSent", "2014-04-27");
filters.put("To", "+XXXXXXXXX");    
MessageList messages = client.getAccount().getMessages(filters);

According to the documentation here https://www.twilio.com/docs/api/rest/message#list-get-filters you are allowed to send> = or <=, but cannot determine where to put the inequality.

+4
source share
1 answer

The Twilio documentation is certainly incomplete and confusing.

Try the following: filters.put("DateSent>", "2014-04-27");

You can even pass two parameters to receive messages between dates:

filters.put("DateSent>", "2014-04-20");
filters.put("DateSent<", "2014-04-27");
+6

Source: https://habr.com/ru/post/1538233/


All Articles