Implement uri generation for the api

Updates tests to cover the expected 'behaviour'.