E
E
Evgeniy Rybalko2020-03-27 13:32:09
RESTful API
Evgeniy Rybalko, 2020-03-27 13:32:09

How to properly design rest resources?

Good afternoon!
Faced with a question that is confusing
Let's say we have a user profile management service. The user profile corresponds to a table in the database with columns: first name, last name, token, etc.
If I want to change the user information (first name last name), I should access the
/rest/user/ endpoint
But if I want to change for example the login token, which endpoint should I access
/rest/user/security/:id:
Generally am i doing right?
There are a lot of fields in the user settings and it makes sense to break them into different blocks from the ui point of view, but from the point of view of what I'm doing on the server side, it seems to me that I'm doing everything wrong

Answer the question

In order to leave comments, you need to log in

2 answer(s)
X
xmoonlight, 2020-03-27
@xmoonlight

The one who is responsible for the action is the end-point.
[Examples]
Object data (user profile): /api/profile/user/<команда(метод)>
Access token:
/api/security/accessToken/<команда(метод)>
Posting:
/api/content/article/new

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question