5

I'm trying to send multiple IDs at once (up to a max of 100), but need to use the data in the same order I send the request with.

So, if I send IDs in an arbitary order like 4;1;3;2, I would like to receive the JSON sorted in the same order, with ID 4's info first, then 1's, then 3's, etc...

Is this possible? Searching around on Stack Apps didn't lead to anything.

If it isn't, would it be worth implementing this as a feature?

0

1 Answer 1

3

This is a classic "procedural" (or "row based" or "sequential") versus "set based" issue. See Understanding “Set based” and “Procedural” approaches in SQL or any one of thousands of similar articles.

The API uses SQL to get its results and the idea of requiring an arbitrary order to results is anathema in SQL -- a sign of possible deficiencies in "set based" thinking.

Because the API uses SQL and because in 99% of cases, an arbitrary-order approach would be suboptimal, I doubt if this feature request will ever get implemented by Stack Exchange.

If you really have one of the cases where an arbitrary order makes real business sense, please add a concrete example to the question. In that case, you will have to reorder the results -- in your desired fashion -- when you display them to the user.

This is not much different than the standard HTTP/AJAX/Packet problem where results can come back in any (unpredictable) order.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .