S
S
slickstars2016-01-27 13:50:42
RESTful API
slickstars, 2016-01-27 13:50:42

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"}
    ]
}

Pulls out at once for all specified users lists of groups.
Which of these 2 methods is more suitable? Or it would be nice to know your opinion.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman_Kh, 2016-01-27
@Roman_Kh

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 question

Ask a Question

731 491 924 answers to any question