Updated the query api