move api path to /api/v1/...
factor out common code for http api responses