I have always found the Excel Connector a very useful way to build session relevance to use with the APIs (assuming of course you have Microsoft Excel). You can find it on the utilities page. The relevance it creates is scalable and wont have the problems @ageorgiev mentions when using a less complex forms of queries.
Rest API and Webreport not the same result
- Reporting - BigFix Forum