Use of search_query_native in Emails API

Hello everyone,
I am using Nylas Emails API to get emails from Microsoft (will implement Google as well in the future).
I am in a situation where I want to get emails that satisfy a list of ids.
For example get emails with ids [“AAkALgAAAAAAH”, “bbaadaaDSdasd”].
While I could make multiple requests to Nylas for a single email, I would prefer to use a url parameter for this. I think that “search_query_native” could be the one to make this work but the following does not seem to work.

query_string = "id:(" + " OR ".join(provider_ids) + ")"
encoded_query = requests.utils.quote(query_string, safe='')
url += f"&search_query_native={encoded_query}"

any ideas?

Hello @gpapidas Here’s our documentation on search_query_native Nylas v3 Email, Calendar, and Contacts API docs | Nylas Docs

The search_query_native parameter is available for Google, Microsoft, and IMAP providers. If you include the search_query_native parameter, you can use only a few specific query parameters with it.

  • Microsoft and IMAP: in, limit and page_token.
  • Google: in, limit, page_token, and thread_id.
  • EWS: Any parameter except thread_id.

I’m afraid what you want to do cannot be done :frowning: To get emails by id, you need to get them one by one…

1 Like

Ok, I’ll probably do it like that then, thanks a lot for the info.