Query e-mails within a specific folder using GetMessages SmarterMail API v1
Question asked by krystal - 1/13/2021 at 7:48 AM
Hi Everyone,

I am trying to get the number of messages received within a certain timeframe. I am using the API below and was able to get messages however it seems to return all messages in the folder and doesn't seem to get the exact number of messages for the dates entered in "MessagesBefore" and "MessagesSince".

POST api/v1/mail/messages 

Can anyone help me understand how messages can be properly queried using this API? Below is my post input, I didn't provide a query on it because I'm not sure how to query it, I tried to enter it in Odata format (in the URI and in the post input/body) but it still returns everything.

"fieldsToSearch""Date",  // tried to use InternalDate here
"folder""Read Receipts",  

4 Replies

Reply to Thread
krystal Replied
I'm still unable to figure out how the messages within a folder can be filtered. Does anyone know? Is it even possible?
Ludovic de RENTY Replied
Hi Community,

I have exactly the same need as krystal, and the same misunderstanding about the usage of "messagesSince" and/or "messagesBefore".
Can anyone help us ?
Zach Sylvester Replied
Employee Post Marked As Answer
Hello Everyone, 

I was able to get this working using the following JSON. 
Please give it a try and let me know if you have any questions. 

Kind Regards, 
Zach Sylvester
Technical Support Specialist
SmarterTools Inc.
(877) 357-6278
Ludovic de RENTY Replied
Thank you Zach for answering!

Unfortunatly, I'm not able to get your sample working for me, the API GetMessages still returns all the emails received in the folder.
Important information: I currently use the version 7242 of SmarterMail, which is not very up-to-date! Maybe it can explain this filtering is not working for me :-/

Reply to Thread