This is a follow up to a previous question of mine, and the starting point is that, given a list of reputation objects retrieved via /users/{ids}/reputation
, I can easily retain only the entries with post_type == 'answers'
and then get post_id
for each of them, ending up with a list of answer_id
s.
Given this list of answer_id
s, how can I efficiently obtain the list of question
objects associated to those answer_id
s without losing the information of which question
comes from which answer_id
?
Clearly, I could make one /answers/{ids}/questions
request for each of the answer_id
s, but this means... I'm being kicked out with a 503 (Service unavailable)
(hence the limits tag).
On the other hand, making one single /answers/{ids}/questions
request for all the ids
(well, I should actually make a request for chunks of 100 entries; then maybe I have to browse the few resulting page
s; but this probably still means a small number of requests), I'm a bit unsure about whether those question
s are obtained in the same order as the the answer_id
s. Quite the opposite, from this answer I understand that there's no guarantee at all that that's the case.
If the retrieved question
s are not sorted as the answer_id
s, then the only way I see to re-establish the relation is to make a /answers/{ids}
request as well (again, in chunks of 100 entries, ...), so that I can recognize which question
corresponds to which answer_id
, as the question_id
is both in question
s and answer
s.
But this looks a bit a convoluted approach. Plus, retrieving the whole answer
objects when all I need is the question_id
for each of them seems overkill.
Is there any other strategy I could adopt? Or is the latter one I described (retrieving all question
s and all answer
s from the answer_id
s) just fine?