I need a URI in my REST API to retrieve the current logged in user. I usually use GETa resource with an identifier, but the client does not know the user ID.
GET
I found the following solutions:
By username
This solution uses a username instead of a user ID.
Example:
GET /user/{userSlug}
With own resource
This solution has one resource for users and one additional resource for a registered user.
Examples:
JIRA REST API :GET /myself
GET /myself
GitHub REST API :GET /user
GET /user
Exchange Stack REST API: GET /me
GET /me
With a symbolic link
This solution has a symbolic link for the user ID.
GET /user/current
With filter
.
:
GET /user?username={username}
RESTful? ?
. REST.
* , , :
5.2.1.1REST - . , , : , (, " -" ), , (, ) .., , , , . , , . [...]
5.2.1.1
REST - . , , : , (, " -" ), , (, ) .., , , , . , , . [...]
/me, /users/me, /users/myself, /users/current , , , .
/me
/users/me
/users/myself
/users/current
/users/{username}.
/users/{username}
, (me/self), REST?
* REST, 5 - .
RESTful. REST URI, RESTfully.
REST - . , . URL- .
Source: https://habr.com/ru/post/1670517/More articles:print dictionary values ββthat are inside a list in python - pythonPrinting a dictionary into a table - pythonIs it legal to have a REST resource like / currentUser, from a RESTful point of view and stateless? - restDoes magic (me / self) use resource identifiers that go against the principles of REST? - restnode js how to parse lines like this? - javascripthttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1670518/difference-between-two-approaches-to-pass-parameters-to-web-server&usg=ALkJrhjnh6xEtfU9CjCGbnk87-LZUhbMOgansible 2: cannot use undef vars in templates - jinja2https://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1670520/spring-custom-annotation-solver-mulitpartfile-resolves-to-null&usg=ALkJrhiaCqf2anEU8vUunriwWpwwNK2INgRails multi-line debugging in bybog or how to save in a single line - ruby ββ| fooobar.comHow to convert Spark Row datasets to string? - javaAll Articles