0

Sorry, I would have left a comment on the other question, but I don't have enough reputation.

I have the same problem as in this question: How to specify many ids and their variable name in a REST API request?

I have a big list of 800+ employees. (I have to show them all at once. It's required by the customer.)

The user can select any number of those employees and move to the next step in the workflow, where I have to fetch some additional informations based on their UUIDs.

My question: should I

  • send multiple GET requests, each with a limited amount of ids in the urls query parameter and join the responses back together in the frontend? (When I request too many ids at once, the request is blocked, because the header is too big).
  • misuse a POST request and send all IDs in the body

Or is there another way?

Thank you for your time.

3
  • 1
    How is this different from the old question? Sep 27, 2022 at 13:02
  • 1
    Adds specific use-case here. That's new. Sep 27, 2022 at 13:15
  • From the RFC: "Providing a block of data, such as the fields entered into an HTML form, to a data-handling process"
    – Laiv
    Sep 27, 2022 at 14:27

1 Answer 1

2

The answer in the linked question is pretty bad. There is no "standard" against querying multiple "ids". In fact, you said the UI already does this. Well, the web is RESTful. So there is "obviously" a way.

misuse a POST request and send all IDs in the body

It's OK to use POST, if the other methods don't fit. And they don't.

Whatever the Web UI is doing, you can safely do the same, you'll be ok. It probably submits a list of checkboxes or something in a form, using POST. Do the same.

Also, doing multiple requests for one use-case is normally an indication that the "API" is badly designed, i.e. not for the use-cases it will be used for.

0

Not the answer you're looking for? Browse other questions tagged or ask your own question.