update function, change ag query to query, api server by query