Answer the question
In order to leave comments, you need to log in
What is the best REST API request?
Hello everyone, there is a task to get a list of groups of each user on the page, there can be about 20 users. What is the best API method to implement for this:
- GET /account/groups/:profileId Pulls
out a list of his groups by the specified user id.
- POST /accounts/groups
{
"accounts":[
{"uuid": "f2e3e57f-3154-4fb9-a006-f7df91230ce7"},
{"uuid": "485fb640-3e02-4616-ae01-3189225df398"}
]
}
Answer the question
In order to leave comments, you need to log in
Both methods can be implemented. I usually prefer to upload large blocks of data from the server, thereby reducing the number of requests, and therefore the load on the server.
Only in both cases you need to use GET, since POST is intended to send data from the client to the server.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question