編輯

共用方式為


News Search APIs v7 query parameters

The following are the query parameters that the request may include. The Required column indicates whether you must specify the parameter. You must URL encode the query parameter values.

These parameters do not affect the list of news articles that Bing Web Search API returns.

Name Value Type Required
cc A 2-character country code of the country where the results come from. For a list of possible values, see Market codes.

If you set this parameter, you must also specify the Accept-Language header. Bing uses the first supported language it finds in the specified languages and combines it with the country code to determine the market to return results for. If the languages list does not include a supported language, Bing finds the closest language and market that supports the request. Or, Bing may use an aggregated or default market for the results.

To know which market Bing used, get the BingAPIs-Market header in the response.

Use this query parameter and the Accept-Language header only if you specify multiple languages. Otherwise, you should use the mkt and setLang query parameters.

This parameter and the mkt query parameter are mutually exclusive — do not specify both.
String No
category The category of news articles to return. For example, Sports or Entertainment articles. For a list of possible categories, see News categories by market.

Use this parameter only with news category requests (see the /news endpoint). If you do not specify this parameter, the response includes up to 10 headline news articles typically published in the last 24 hours from any category.
String No
count The number of news articles to return in the response. The actual number delivered may be less than requested. The default is 10 and the maximum is 100.

You may use this parameter along with the offset parameter to page results. For example, if your user interface presents 20 articles per page, set count to 20 and offset to 0 to get the first page of results. For each subsequent page, increment offset by 20 (for example, 0, 20, 40). It is possible for multiple pages to include some overlap in results.

Use this parameter only when calling the /news/search endpoint. Do not specify this parameter when calling the /news or /news/trendingtopics endpoint.
UnsignedShort No
freshness Filter news articles by the following age values:
  • Day — Return news articles that Bing discovered within the last 24 hours.
  • Week — Return news articles that Bing discovered within the last 7 days.
  • Month — Return news articles that Bing discovered within the last 30 days.

    Use this parameter only when calling the /news/search endpoint. Do not specify this parameter when calling the /news or /news/trendingtopics endpoint.
String No
mkt The market where the results come from. Typically, mkt is the country where the user is making the request from. However, it could be a different country if the user is not located in a country where Bing delivers results. The market must be in the form <language>-<country/region>. For example, en-US. The string is case insensitive. For a list of possible market values, see Market codes.

NOTE: If known, you are encouraged to always specify the market. Specifying the market helps Bing route the request and return an appropriate and optimal response. If you specify a market that is not listed in Market codes, Bing uses a best fit market code based on an internal mapping that is subject to change.

To know which market Bing used, get the BingAPIs-Market header in the response.

This parameter and the cc query parameter are mutually exclusive — do not specify both.
String No
offset The zero-based offset that indicates the number of news articles to skip before returning results. The default is 0. The offset should be less than (totalEstimatedMatches - count).

Use this parameter along with the count parameter to page results. For example, if your user interface displays 10 articles per page, set count to 10 and offset to 0 to get the first page of results. For each subsequent page, increment offset by 10 (for example, 0, 10, 20). It is possible for multiple pages to include some overlap in results.

Use this parameter only when calling the /news/search endpoint. Do not specify this parameter when calling the /news or /news/trendingtopics endpoint.
Unsigned Short No
originalImg A Boolean value that determines whether the Image object include the contentUrl field or only the thumbnail field.

If the article includes an image and this parameter is set to true, the Image object includes the contentUrl field, which points to the original original image on the publisher's website. Otherwise, Image object includes only the thumbnail field.

The default is false.

Use this parameter only when calling the /news/search endpoint. Do not specify this parameter when calling the /news or /news/trendingtopics endpoint.
Boolean No
q The user's search query term. If the term is empty (for example, q=), the response includes the top news stories.

The term may contain Bing Advanced Operators. For example, to limit results to a specific domain, use the site: operator (q=fishing+site:fishing.contoso.com). Note that the results may contain results from other sites depending on the number of relevant results found on the specified site.

Use this parameter only when calling the /news/search endpoint. Do not specify this parameter when calling the /news or /news/trendingtopics endpoint.
String Yes
safeSearch Used to filter news articles for adult content. The following are the possible values:
  • Off—Return news articles with adult text, images, or videos.

  • Moderate—Return news articles with adult text but not adult images or videos.

  • Strict—Do not return news articles with adult text, images, or videos.
The default is Moderate.

NOTE: If the request comes from a market that Bing's adult policy requires that safeSearch be set to Strict, Bing ignores the safeSearch value and uses Strict.
String No
setLang The language to use for user interface strings. You may specify the language using either a 2-letter or 4-letter code. Using 4-letter codes is preferred.

For a list of supported language codes, see Bing supported languages.

Bing loads the localized strings if setlang contains a valid 2-letter neutral culture code (fr) or a valid 4-letter specific culture code (fr-ca). For example, for fr-ca, Bing loads the fr neutral culture code strings.

If setlang is not valid (for example, zh) or Bing doesn’t support the language (for example, af, af-na), Bing defaults to en (English).

To specify the 2-letter code, set this parameter to an ISO 639-1 language code.

To specify the 4-letter code, use the form <language>-<country/region> where <language> is an ISO 639-1 language code (neutral culture) and <country/region> is an ISO 3166 country/region (specific culture) code. For example, use en-US for United States English.

Although optional, you should always specify the language. Typically, you set setLang to the same language specified by mkt unless the user wants the user interface strings displayed in a different language.

This parameter and the Accept-Language header are mutually exclusive — do not specify both.

A user interface string is a string that's used as a label in a user interface. There are few user interface strings in the JSON response objects. Also, any links to Bing.com properties in the response objects use the specified language.
String No
since The UNIX epoch time (Unix timestamp) that Bing uses to select the trending topics. Bing returns trending topics that it discovered on or after the specified date and time, not the date the topic was published.

To use this parameter, also specify the sortBy parameter and set it to Date.
Integer No
sortBy The order to return news topics in. The following are the possible case-insensitive values:
  • Date — Returns news topics sorted by date from the most recent to the oldest.
  • Relevance — Returns news topics sorted by relevance, which considers topic freshness, category, global user engagement, and personalized features.
If you're using Trending News API and specify the since query parameter, you must set this parameter to Date.
String No
textDecorations A Boolean value that determines whether display strings in the results should contain decoration markers such as hit highlighting characters. If true, the strings may include markers. The default is false.

To specify whether to use Unicode characters or HTML tags as the markers, see the textFormat query parameter.

For information about hit highlighting, see Hit highlighting.
Boolean No
textFormat The type of markers to use for text decorations (see the textDecorations query parameter).

The following are the possible values:
  • Raw — Use Unicode characters to mark content that needs special formatting. The Unicode characters are in the range E000 through E019. For example, Bing uses E000 and E001 to mark the beginning and end of query terms for hit highlighting.

  • HTML — Use HTML tags to mark content that needs special formatting. For example, use <b> tags to highlight query terms in display strings.
The default is Raw.

For a list of markers and information about processing strings with the embedded Unicode characters, see Hit highlighting.

For display strings that contain escapable HTML characters such as <, >, and &, if textFormat is set to HTML, Bing escapes the characters as appropriate (for example, < is escaped to &lt;).
String No

News categories by market

The following are the possible news categories that you may set the category query parameter to. You may set category to a parent category such as Entertainment or one of its subcategories such as Entertainment_MovieAndTV. If you set category to a parent category, it includes articles from one or more of its subcategories. If you set category to a subcategory, it includes articles only from that subcategory.

Market Supported Categories
Australia (en-AU)
  • Australia
  • Business
  • Entertainment
  • Politics
  • Sports
  • World
Canada (en-CA)
  • Business
  • Canada
  • Entertainment
  • LifeStyle
  • Politics
  • ScienceAndTechnology
  • Sports
  • World
China (zh-CN)
  • Auto
  • Business
  • China
  • Education
  • Entertainment
  • Military
  • RealEstate
  • ScienceAndTechnology
  • Society
  • Sports
  • World
India (en-IN)
  • Business
  • Entertainment
  • India
  • LifeStyle
  • Politics
  • ScienceAndTechnology
  • Sports
  • World
Japan (ja-JP)
  • Business
  • Entertainment
  • Japan
  • LifeStyle
  • Politics
  • ScienceAndTechnology
  • Sports
  • World
United Kingdom (en-GB)
  • Business
  • Entertainment
  • Health
  • Politics
  • ScienceAndTechnology
  • Sports
  • UK
  • World
United States (en-US)
  • Business
  • Entertainment
    • Entertainment_MovieAndTV
    • Entertainment_Music
  • Health
  • Politics
  • Products
  • ScienceAndTechnology
    • Technology
    • Science
  • Sports
    • Sports_Golf
    • Sports_MLB
    • Sports_NBA
    • Sports_NFL
    • Sports_NHL
    • Sports_Soccer
    • Sports_Tennis
    • Sports_CFB
    • Sports_CBB
  • US
    • US_Northeast
    • US_South
    • US_Midwest
    • US_West
  • World
  • World_Africa
  • World_Americas
  • World_Asia
  • World_Europe
  • World_MiddleEast