moved call from query to rest api call