So, I'm parsing every post - question or answer - for a concordance that I am building. (If you're interested, you can see where I am at http://seconcordance.cloudapp.net. Don't worry - full attributions are in there, etc...) My program reads through the body of each question and/or answer to locate Bible references, and then stores links to questions on christianity.stackexchange itself. The logical api is thus /posts, since it returns both questions and answers.

On my index page, I'd like to be able to see the tags associated with the question being asked, or, if the link is to an answer, the tags associated with the parent question. Unfortunately, I see no way to derive the tags of the questions from the /posts route.

Question 1: Am I missing something here? Is it possible to derive the tags directly from posts in some fashion?

Playing around with the filters, it doesn't appear that I can, but I am totally open to the possibility that I missed something.

Question 2: How do I derive the parent question from an answer post?

Barring question 1, the next logical approach would seem to be to make a second API call for each question, using the id of the question in the /questions api call, and return those tags. For questions, this may be inefficient, but it would work.

My problem is, how do I then reassociate the answers with the questions to which they were originally attached? I don't see any property of the answer that links me back to the question, so that internally, I can associate in that fashion.

So, how do I derive the parent question from an answer in the /posts call?

  • Hm, it doesn't seem like you can do this easily; you'd have to examine post_type and then send another request to /answers/{ids} to get the parent information back. As a side note, you made me realise that this request had actually been implemented, thanks!
    – Tim Stone
    Apr 2 '14 at 20:37
  • The /posts path is pretty limited. I would use /questions and /answers separately. This covers all posts and the /answers path can be set/filtered to return the tags and the owning question ID. ... Everything's returned in two, non-overlapping trips to the API, where as the /posts approach requires two calls for every answer. Apr 3 '14 at 0:27

You must log in to answer this question.

Browse other questions tagged .