Reddit search api - searching by subbreddit

2.4k Views Asked by At

I've been following the Reddit API documentation but I think I'm doing something wrong. When I try searching one particular subreddit for a query, it brings back results for all subreddits.

In this example I want to return all the posts in /r/Volvo relating to wagons, however the query returns corresponding posts for numerous subbreddits.

http://www.reddit.com/r/volvo/search.xml?q=wagon

So am I missing something glaringly obvious? (I guess I am!)

Thanks in advance.

1

There are 1 best solutions below

0
On BEST ANSWER

The default behavior returns results from all subreddits.

To restrict results to the subreddit, multireddit, or domain-listing in the URL, use the restrict_sr query parameter, like so:

http://www.reddit.com/r/volvo/search.xml?q=wagon&restrict_sr=on

See also https://www.reddit.com/dev/api#GET_search