Refactor url handling functions
Add /api/clients