3

I'd like to find out the times in the history of a question when it was closed and reopened. How can I do that using API v2?

The closest relevant call I have found is /questions/{ids}/timeline, which returns a list of question_timeline, which has a timeline_type field that could be post_state_changed. However, there doesn't seem to be any way to find out what that state changed to: was is closed? reopened? locked? unlocked? wikified?

It seems to me that the question_timeline data are incomplete, and the API should be enhanced. (Or, if there is a way to extract that information, then it should be clarified in the documentation.)

I've also looked at /questions/{ids}, which tells you the closed_date. Since there is no reopened_date, I conclude that closed_date would only be present if the question is currently closed, and that it doesn't tell you anything about historical state transitions.

1 Answer 1

2

You can get at this information, but it's messy.

Using the /posts/{id}/revisions route you can query for the list of all revision events for a particular question, which includes close/reopen events. These have revision_type = "vote_based" which you can filter the results by, but so do delete/undelete and protect/unprotect events, meaning you ultimately have to parse the comment field for <b>Post Closed, etc.

You can see all of the various different states in action in the revisions of Jon Skeet Facts, which corresponds to the on-site question history.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.