Skip to main content
replaced http://stackapps.com/ with https://stackapps.com/
Source Link

There is indeed a way: Just use an appropriate filter with /questions or /search.

For example, you can get roughly the JSON equivalent of page How do I get a GreaseMonkey/UserScript to interact with the Live Preview?How do I get a GreaseMonkey/UserScript to interact with the Live Preview? with this query:

https://api.stackexchange.com/2.2/questions/2804?&site=stackapps.com&filter=!BHTP%29W3VIPP%29cNVPt8on92i1%28WJFk1

The key is to configure the filter not only to include the /questions elements you want, but also the /answers elements and even the /comments elements. (Or just reuse the above filter.)

If in the filter's question fields you have selected answers, the API will apply the filter's answer fields to determine what answer fields to include. If in the filter's answer fields you have selected comments, the API will apply the filter's comment fields to determine what comment fields to include in the answer parts of the questions result of your /questions query. Likewise for the question's immediate comments.

So why have I not found this during my initial search for a solution? (I am answering my own question here)

Two reasons:

  • It is not enough, when assessing the /questions query type, to read the page /docs/questions-by-ids (or /docs/questions for that matter), you also need to follow the link "question objects" to get enlightened.
  • The term "filter" for the filters is misleading. "transitive results structure specifiers" would be more appropriate.

My conclusion: There is room left for improvement of the API documentation, but the API itself is quite flexible.

There is indeed a way: Just use an appropriate filter with /questions or /search.

For example, you can get roughly the JSON equivalent of page How do I get a GreaseMonkey/UserScript to interact with the Live Preview? with this query:

https://api.stackexchange.com/2.2/questions/2804?&site=stackapps.com&filter=!BHTP%29W3VIPP%29cNVPt8on92i1%28WJFk1

The key is to configure the filter not only to include the /questions elements you want, but also the /answers elements and even the /comments elements. (Or just reuse the above filter.)

If in the filter's question fields you have selected answers, the API will apply the filter's answer fields to determine what answer fields to include. If in the filter's answer fields you have selected comments, the API will apply the filter's comment fields to determine what comment fields to include in the answer parts of the questions result of your /questions query. Likewise for the question's immediate comments.

So why have I not found this during my initial search for a solution? (I am answering my own question here)

Two reasons:

  • It is not enough, when assessing the /questions query type, to read the page /docs/questions-by-ids (or /docs/questions for that matter), you also need to follow the link "question objects" to get enlightened.
  • The term "filter" for the filters is misleading. "transitive results structure specifiers" would be more appropriate.

My conclusion: There is room left for improvement of the API documentation, but the API itself is quite flexible.

There is indeed a way: Just use an appropriate filter with /questions or /search.

For example, you can get roughly the JSON equivalent of page How do I get a GreaseMonkey/UserScript to interact with the Live Preview? with this query:

https://api.stackexchange.com/2.2/questions/2804?&site=stackapps.com&filter=!BHTP%29W3VIPP%29cNVPt8on92i1%28WJFk1

The key is to configure the filter not only to include the /questions elements you want, but also the /answers elements and even the /comments elements. (Or just reuse the above filter.)

If in the filter's question fields you have selected answers, the API will apply the filter's answer fields to determine what answer fields to include. If in the filter's answer fields you have selected comments, the API will apply the filter's comment fields to determine what comment fields to include in the answer parts of the questions result of your /questions query. Likewise for the question's immediate comments.

So why have I not found this during my initial search for a solution? (I am answering my own question here)

Two reasons:

  • It is not enough, when assessing the /questions query type, to read the page /docs/questions-by-ids (or /docs/questions for that matter), you also need to follow the link "question objects" to get enlightened.
  • The term "filter" for the filters is misleading. "transitive results structure specifiers" would be more appropriate.

My conclusion: There is room left for improvement of the API documentation, but the API itself is quite flexible.

clarified wording of the second paragraph
Source Link

There is indeed a way: Just use an appropriate filter with /questions or /search.

For example, you can get roughly the JSON equivalent of page How do I get a GreaseMonkey/UserScript to interact with the Live Preview? with this query:

https://api.stackexchange.com/2.2/questions/2804?&site=stackapps.com&filter=!BHTP%29W3VIPP%29cNVPt8on92i1%28WJFk1

The key is to configure the filter not only to include the /questions elements you want, but also the /answers elements and even the /comments elements. (Or just reuse the above filter.)

If in the filter's question fields you have selected answers, the API will apply the filter's answer fields to determine what answer fields to include. If in the filter's answer fields you have selected comments, the API will apply the filter's comment fields to determine what comment fields to include in the answer parts of the questions result of your /questions query. Likewise for the question's immediate comments.

So why have I not found this during my initial search for a solution? (I am answering my own question here)

Two reasons:

  • It is not enough, when assessing the /questions query type, to read the page /docs/questions-by-ids (or /docs/questions for that matter), you also need to follow the link "question objects" to get enlightened.
  • The term "filter" for the filters is misleading. "transitive results structure specifiers" would be more appropriate.

My conclusion: There is room left for improvement of the API documentation, but the API itself is quite flexible.

There is indeed a way: Just use an appropriate filter with /questions or /search.

For example, you can get page How do I get a GreaseMonkey/UserScript to interact with the Live Preview? with this query:

https://api.stackexchange.com/2.2/questions/2804?&site=stackapps.com&filter=!BHTP%29W3VIPP%29cNVPt8on92i1%28WJFk1

The key is to configure the filter not only to include the /questions elements you want, but also the /answers elements and even the /comments elements. (Or just reuse the above filter.)

If in the filter's question fields you have selected answers, the API will apply the filter's answer fields to determine what answer fields to include. If in the filter's answer fields you have selected comments, the API will apply the filter's comment fields to determine what comment fields to include in the answer parts of the questions result of your /questions query. Likewise for the question's immediate comments.

So why have I not found this during my initial search for a solution? (I am answering my own question here)

Two reasons:

  • It is not enough, when assessing the /questions query type, to read the page /docs/questions-by-ids (or /docs/questions for that matter), you also need to follow the link "question objects" to get enlightened.
  • The term "filter" for the filters is misleading. "transitive results structure specifiers" would be more appropriate.

My conclusion: There is room left for improvement of the API documentation, but the API itself is quite flexible.

There is indeed a way: Just use an appropriate filter with /questions or /search.

For example, you can get roughly the JSON equivalent of page How do I get a GreaseMonkey/UserScript to interact with the Live Preview? with this query:

https://api.stackexchange.com/2.2/questions/2804?&site=stackapps.com&filter=!BHTP%29W3VIPP%29cNVPt8on92i1%28WJFk1

The key is to configure the filter not only to include the /questions elements you want, but also the /answers elements and even the /comments elements. (Or just reuse the above filter.)

If in the filter's question fields you have selected answers, the API will apply the filter's answer fields to determine what answer fields to include. If in the filter's answer fields you have selected comments, the API will apply the filter's comment fields to determine what comment fields to include in the answer parts of the questions result of your /questions query. Likewise for the question's immediate comments.

So why have I not found this during my initial search for a solution? (I am answering my own question here)

Two reasons:

  • It is not enough, when assessing the /questions query type, to read the page /docs/questions-by-ids (or /docs/questions for that matter), you also need to follow the link "question objects" to get enlightened.
  • The term "filter" for the filters is misleading. "transitive results structure specifiers" would be more appropriate.

My conclusion: There is room left for improvement of the API documentation, but the API itself is quite flexible.

Source Link

There is indeed a way: Just use an appropriate filter with /questions or /search.

For example, you can get page How do I get a GreaseMonkey/UserScript to interact with the Live Preview? with this query:

https://api.stackexchange.com/2.2/questions/2804?&site=stackapps.com&filter=!BHTP%29W3VIPP%29cNVPt8on92i1%28WJFk1

The key is to configure the filter not only to include the /questions elements you want, but also the /answers elements and even the /comments elements. (Or just reuse the above filter.)

If in the filter's question fields you have selected answers, the API will apply the filter's answer fields to determine what answer fields to include. If in the filter's answer fields you have selected comments, the API will apply the filter's comment fields to determine what comment fields to include in the answer parts of the questions result of your /questions query. Likewise for the question's immediate comments.

So why have I not found this during my initial search for a solution? (I am answering my own question here)

Two reasons:

  • It is not enough, when assessing the /questions query type, to read the page /docs/questions-by-ids (or /docs/questions for that matter), you also need to follow the link "question objects" to get enlightened.
  • The term "filter" for the filters is misleading. "transitive results structure specifiers" would be more appropriate.

My conclusion: There is room left for improvement of the API documentation, but the API itself is quite flexible.