4

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 1;2;3;4, I would like to receive the JSON sorted in the same order, with ID 1's info first, then 2's, then 3's, etc...

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

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

  • 1
    If you really want 1;2;3;4, that's doable. You really meant a more arbitrary sequence like 4;2;1;3, right? – Brock Adams May 1 '15 at 22:27
  • @BrockAdams Yes, I did :) – ᔕᖺᘎᕊ May 2 '15 at 11:51
  • @2mkgz Thanks! Great idea. I've edited the script now :) – ᔕᖺᘎᕊ May 2 '15 at 11:52
2

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 .