integrate Query api call with other parts