I am trying to retrieve my SMS log using the REST api but I can't figure out how to filter DateSent to be >= or <= than given 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 documentation here https://www.twilio.com/docs/api/rest/message#list-get-filters you are allowed to send >= or <=, but can't figure out where to put the inequality.
Twilio's SMS API helps you send and manage messages programmatically: To send an outbound SMS, WhatsApp, or Channels message with the API, POST to the Message resource. You'll also use the Message resource to fetch messages and list messages associated with your account.
The Twilio REST API allows you to query metadata about your account, phone numbers, calls, text messages, and recordings. You can also do some fancy things like initiate outbound calls and send text messages.
Twilio receives the message from the carrier over a dedicated connection between Twilio and that carrier. The message then lands in Twilio's messaging processing stack where Twilio has written software to receive and interpret that message.
That Twilio documentation certainly is incomplete and confusing.
Try this: filters.put("DateSent>", "2014-04-27");
You can even pass two parameters to retrieve messages between dates:
filters.put("DateSent>", "2014-04-20");
filters.put("DateSent<", "2014-04-27");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With