Getting the only user is /employee/{id}. What should be obtained through this URL is the user entity object. For the properties inside the entity object: code . Should not be obtained by exposing the URL.
The first step when designing RESTURL is resource abstraction. It is necessary to clearly distinguish which resources can be extracted and design a unique URL. What can’t be done
RESTful resources generally use plural numbers. I think code can also be used as a search condition: /employees/search?code=xxx. Of course, code can also be obtained and changed as a resource of employee, but when searching for employee through code, it should be Belongs to the search function.
/employee/code/{code}
Getting the only user is /employee/{id}. What should be obtained through this URL is the user entity object.
For the properties inside the entity object: code . Should not be obtained by exposing the URL.
The first step when designing RESTURL is resource abstraction. It is necessary to clearly distinguish which resources can be extracted and design a unique URL. What can’t be done
RESTful resources generally use plural numbers. I think code can also be used as a search condition: /employees/search?code=xxx. Of course, code can also be obtained and changed as a resource of employee, but when searching for employee through code, it should be Belongs to the search function.