Added getCount() to REST/JSON API, closes #814