GET /search/advanced

stackexchange.com

Summary:
Operation ID:
Auth: unknown
Description

Searches a site for any questions which fit the given criteria. Search criteria are expressed using the following parameters: - q - a free form text parameter, will match all question properties based on an undocumented algorithm. - accepted - true to return only questions with accepted answers, false to return only those without. Omit to elide constraint. - answers - the minimum number of answers returned questions must have. - body - text which must appear in returned questions' bodies. - closed - true to return only closed questions, false to return only open ones. Omit to elide constraint. - migrated - true to return only questions migrated away from a site, false to return only those not. Omit to elide constraint. - notice - true to return only questions with post notices, false to return only those without. Omit to elide constraint. - nottagged - a semicolon delimited list of tags, none of which will be present on returned questions. - tagged - a semicolon delimited list of tags, of which at least one will be present on all returned questions. - title - text which must appear in returned questions' titles. - user - the id of the user who must own the questions returned. - url - a url which must be contained in a post, may include a wildcard. - views - the minimum number of views returned questions must have. - wiki - true to return only community wiki questions, false to return only non-community wiki ones. Omit to elide constraint. At least one additional parameter must be set if nottagged is set, for performance reasons. The sorts accepted by this method operate on the follow fields of the question object: - activity - last_activity_date - creation - creation_date - votes - score - relevance - matches the relevance tab on the site itself Does not accept min or max activity is the default sort. It is possible to create moderately complex queries using sort, min, max, fromdate, and todate. This method returns a list of questions.

Parameters (25)

accepted (string, query, optional)

Constraints: {'enum': [True, False]}

answers (integer, query, optional)
body (string, query, optional)
callback (string, query, optional)

All API responses are JSON, we do support JSONP with the callback query parameter.

closed (string, query, optional)

Constraints: {'enum': [True, False]}

filter (string, query, optional)

#Discussion The Stack Exchange API allows applications to exclude almost every field returned. For example, if an application did not care about a user's badge counts it could exclude user.badge_counts whenever it calls a method that returns users. An application excludes fields by creating a filter (via /filter/create) and passing it to a method in the filter parameter. Filters are immutable and non-expiring. An application can safely "bake in" any filters that are created, it is not necessary (or advisable) to create filters at runtime. The motivation for filters are several fold. Filters allow applications to reduce API responses to just the fields they are concerned with, saving bandwidth. With the list of fields an application is actually concerned with, the API can avoid unneccessary queries thereby decreasing response time (and reducing load on our infrastructure). Finally, filters allow us to be more conservative in what the API returns by default without a proliferation of parameters (as was seen with body, answers, and comments in the 1.x API family). #Safety Filters also carry a notion of safety, which is defined as follows. Any string returned as a result of an API call with a safe filter will be inline-able into HTML without script-injection concerns. That is to say, no additional sanitizing (encoding, HTML tag stripping, etc.) will be necessary on returned strings. Applications that wish to handle sanitizing themselves should create an unsafe filter. All filters are safe by default, under the assumption that double-encoding bugs are more desirable than script injections. Note that this does not mean that "safe" filter is mearly an "unsafe" one with all fields passed though UrlEncode(...). Many fields can and will contain HTML in all filter types (most notably, the *.body fields). When using unsafe filters, the API returns the highest fidelity data it can reasonably access for the given request. This means that in cases where the "safe" data is the only accessible data it will be returned even in "unsafe" filters. Notably the *.body fields are unchanged, as they are stored in that form. Fields that are unchanged between safe and unsafe filters are denoted in their types documentation. #Built In Filters The following filters are built in: default, each type documents which fields are returned under the default filter (for example, answers). withbody, which is default plus the *.body fields none, which is empty total, which includes just .total #Compatibility with V1.x For ease of transition from earlier API versions, the filters _b, _ba, _bc, _bca, _a, _ac, and _c are also built in. These are unsafe, and exclude a combination of question and answer body, comments, and answers so as to mimic the body, answers, and comments parameters that have been removed in V2.0. New applications should not use these filters.

fromdate (integer, query, optional)

Unix date.

max (string, query, optional)

sort = activity => date sort = creation => date sort = votes => number sort = relevance => none

migrated (string, query, optional)

Constraints: {'enum': [True, False]}

min (string, query, optional)

sort = activity => date sort = creation => date sort = votes => number sort = relevance => none

notice (string, query, optional)

Constraints: {'enum': [True, False]}

nottagged (string, query, optional)

String list (semicolon delimited).

order (string, query, optional)

Constraints: {'enum': ['desc', 'asc']}

page (integer, query, optional)
pagesize (integer, query, optional)
q (string, query, optional)
site (string, query, required)

Each of these methods operates on a single site at a time, identified by the site parameter. This parameter can be the full domain name (ie. "stackoverflow.com"), or a short form identified by api_site_parameter on the site object.

sort (string, query, optional)

Constraints: {'enum': ['activity', 'creation', 'votes', 'relevance']}

tagged (string, query, optional)

String list (semicolon delimited).

title (string, query, optional)
todate (integer, query, optional)

Unix date.

url (string, query, optional)
user (integer, query, optional)
views (integer, query, optional)
wiki (string, query, optional)

Constraints: {'enum': [True, False]}

No probe data for this endpoint yet.