메시지 검색
messages.list
및 threads.list
메서드를 사용하여 파일을 검색하거나 필터링할 수 있습니다.
이 메서드는 Gmail 웹 인터페이스와 동일한 고급 검색 문법의 대부분을 지원하는 q
매개변수를 허용합니다. Gmail UI와 Gmail API의 검색 및 필터링 차이점 목록은 검색 필터 차이: Gmail UI와 Gmail API 비교를 참고하세요.
이 고급 문법을 사용하면 검색어를 사용하여 발신자, 날짜, 라벨과 같은 속성별로 메일을 필터링할 수 있습니다. 예를 들어 다음 쿼리는 2014년 1월에 사용자가 보낸 모든 메시지를 검색합니다.
GET https://www.googleapis.com/gmail/v1/users/me/messages?q=in:sent after:2014/01/01 before:2014/02/01
검색어 외에도 labelIds
매개변수를 사용하여 라벨로 메시지와 대화목록을 필터링할 수도 있습니다. 이렇게 하면 지정된 시스템 또는 사용자 라벨이 적용된 메시지와 대화목록을 검색할 수 있습니다. 자세한 내용은 messages.list
또는 threads.list
메서드 참조를 참고하세요.
검색 및 필터링 차이: Gmail UI와 Gmail API
Gmail UI는 Google Workspace 계정에서 계정 별칭을 추론할 수 있는 별칭 확장을 실행합니다. 예를 들어 myprimary@mycompany.net
계정이 있고 관리자가 이 계정의 별칭을 myalias@mycompany.net
로 설정했다고 가정해 보겠습니다. myalias@mycompany.net
에서 이메일을 보내지만 'from: myprimary@mycompany.net)
'를 검색하면 myalias@mycompany.net
에서 보낸 이메일이 Gmail UI의 검색 결과로 표시되지만 API 응답에는 표시되지 않습니다.
Gmail UI에서는 사용자가 대화목록 전체 검색을 실행할 수 있지만 API는 이를 지원하지 않습니다.
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2024-11-23(UTC)
[null,null,["최종 업데이트: 2024-11-23(UTC)"],[[["The Gmail API provides methods (`messages.list` and `threads.list`) to search and filter emails using the `q` parameter, supporting advanced search syntax similar to the Gmail web interface."],["You can construct search queries to filter emails by attributes like sender, date, or label, with a caveat that dates are interpreted as PST midnight unless specified in seconds."],["Filtering can also be done by label using the `labelIds` parameter, allowing searches for messages with specific system or user labels."],["While the Gmail UI automatically expands aliases in searches, the API does not, meaning searches must use the exact email address."],["Thread-wide searches are supported in the Gmail UI but are not available through the API."]]],[]]