sends query to API