You can use the "EntityQuery" or the "CZQLQuery" to query the API.
From our success site:
"CZQLQuery — A new query language to easily perform queries via the API. CZQL supports all the query operators previously available via the EntityQuery API and also the new AggregateQuery capabilities."
For examples of how the CZQLQuery works go here. The examples are for the REST API but it also works in the SOAP.
I hope this helps,