rest - Name or ID as url for restful api -


i build restful api users route. more idioatic use username or id parameter if username unique?

either

example.com/api/users/johndoe 

or

example.com/api/users/123456 

furthermore planed routes project resource. inconsistent design, if require project-id here?

usually username can remembered more recommend use id in username there may spaces or other characters (for example german umlaute) difficult format url. may be, user changes name. links invalid in opposite id.


Comments

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -