I am confused whether we should create separate API for fetching result and result-count OR we should fetch count based on query string in the result API only.
/api/results/ : Fetches all records
/api/results/?city=1: Fetches all records with city=1
/api/results/?iscount=1: Fetches the count of records i.e. list of cityId and count of record for respective cityId
/api/results/?city=1&iscount=1: Fetch the count of record for cityId=1
OR
/api/resultcount/: Fetches the count of records i.e. list of cityId and count of record for respective cityId
/api/resultcount/?city=1: Fetch the count of record for cityId=1
To me query string is used for filtering of resource so, I am in favor of creating separate API for fetching the counts. Opinion?