5

My question is similar to: Getting questions that have a specific tag or tags?

What I am trying to do is get a list of Featured questions within a list of tags. I have tried using the following:

Note link to doc: http://api.stackexchange.com/docs/featured-questions

But when I add more then one tag it appears to be using and instead of or. I was unable to find an or operator as ; appears to be and.

Example 1: Right now because there is a featured question tagged with this will return correctly:
https://api.stackexchange.com/2.2/questions/featured?order=desc&sort=activity&tagged=google-analytics&site=stackoverflow

Example 2: But I would also like to see any featured questions within the tag. This currently returns nothing because I am using both the Google-Analytics tag and the oauth2 tag:
https://api.stackexchange.com/2.2/questions/featured?order=desc&sort=activity&tagged=google-analytics;oauth2&site=stackoverflow

The /search path says:

tagged and nottagged are semi-colon delimited list of tags. At least 1 tag in tagged will be on each returned question if it is passed, making it the OR equivalent of the AND version of tagged on /questions.

If I understand that correctly, /search uses ; for or logic, but unfortunately doesn't let me search only on featured questions.

1 Answer 1

3

Currently the API does not let you get "featured" questions (questions that have bounties) using or logic with the tag parameters. That is, you cannot search for questions that:
Have a bounty AND (have Tag-A OR Tag-B)

It might make sense to add a hasbounty parameter to the /search/advanced path.

Workaround:

In the meantime, since the number of featured questions is quite small (currently only 413 on Stack Overflow), just use multiple queries to the /questions/featured path to get what you want.

For example:

  1. Query /questions/featured?tagged=google-analytics&site=stackoverflow
  2. Then query /questions/featured?tagged=oauth2&site=stackoverflow
  3. Then combine the results and eliminate any duplicate questions.
1
  • 1
    Agreed that's the work around I am currently using. But I dislike spamming nice APIs with extra requests that I could get back in a single request. I wanted to be sure I was understanding a limitation in the current workings of the API. thank you :)
    – DaImTo
    Apr 9, 2014 at 9:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .