'GET /api/categories
Return a list of dictionaries that contain information about each Category.
:param deleted: flag used to include deleted categories
Example: GET localhost:9009/api/categories'

@expose_api_anonymous_and_sessionless
def index(self, trans, deleted=False, **kwd):

    category_dicts = []
    deleted = util.asbool(deleted)
    if (deleted and (not trans.user_is_admin())):
        raise exceptions.AdminRequiredException('Only    administrators    can    query    deleted    categories.')
    for category in trans.sa_session.query(self.app.model.Category).filter((self.app.model.Category.table.c.deleted == deleted)).order_by(self.app.model.Category.table.c.name):
        category_dict = category.to_dict(view='collection', value_mapper=self.__get_value_mapper(trans))
        category_dict['url'] = web.url_for(controller='categories', action='show', id=trans.security.encode_id(category.id))
        category_dict['repositories'] = self.app.repository_registry.viewable_repositories_and_suites_by_category.get(category.name, 0)
        category_dicts.append(category_dict)
    return category_dicts
