MT#3997 Distinguish collection and item in URI

Use /api/foo/ for collections and /api/foo/{:id} for items to easily
distinguish between them.  Also, we want to use query params for limiting
the collections, e.g. /api/foo/?name={:name}&something={:else}, which in
turn returns a filtered collection again. This makes it difficult then to
fetch items via /api/foo/?id={:id}, so use /api/foo/{:id} instead.

Also move rest of common functions into API Role.