restructured REST url handling in api