More work to use new /hosts API call and credentials in ajax calls.