您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.

新闻搜索 API v7 参考News Search API v7 reference

警告

必应搜索 API 将从认知服务迁移到必应搜索服务。Bing Search APIs are moving from Cognitive Services to Bing Search Services. 2020 年10月 30 日起,需要按照 此处所述的过程设置必应搜索的任何新实例。Starting October 30, 2020 , any new instances of Bing Search need to be provisioned following the process documented here. 在接下来的三年中,将支持使用认知服务进行预配的必应搜索 API,或者在企业协议结束后(以先发生者为准)。Bing Search APIs provisioned using Cognitive Services will be supported for the next three years or until the end of your Enterprise Agreement, whichever happens first. 有关迁移说明,请参阅 必应搜索服务For migration instructions, see Bing Search Services.

利用新闻搜索 API,你可以将搜索查询发送到必应,并获取相关新闻文章的列表。The News Search API lets you send a search query to Bing and get back a list of relevant news articles. 本部分提供有关查询参数和标头的技术详细信息,这些信息用于请求新闻文章以及包含它们的 JSON 响应对象。This section provides technical details about the query parameters and headers that you use to request news articles and the JSON response objects that contain them. 有关演示如何发出请求的示例,请参阅 在 Web 中搜索新闻For examples that show how to make requests, see Searching the Web for News.

有关请求应包括的标头的信息,请参阅 请求标头For information about the headers that requests should include, see Request Headers.

有关请求应包括的查询参数的信息,请参阅 查询参数For information about the query parameters that requests should include, see Query Parameters.

有关响应可能包含的 JSON 对象的信息,请参阅 Response 对象For information about the JSON objects that the response may include, see Response Objects.

有关允许的使用和显示结果的信息,请参阅 必应搜索 API 使用和显示要求For information about permitted use and display of results, see Bing Search API Use and Display requirements.

备注

由于 URL 格式和参数可能会在未另行通知的情况下有所更改,请按现状使用所有 URL。Because URL formats and parameters are subject to change without notice, use all URLs as-is. 不应依赖于 URL 格式或参数,除非另有说明。You should not take dependencies on the URL format or parameters except where noted.

终结点Endpoints

若要请求新闻文章,请将 GET 请求发送到以下 Url 之一:To request news articles, send a GET request to one of the following URLs:

URLURL 描述Description
https://api.cognitive.microsoft.com/bing/v7.0/news 返回按类别列出的热门新闻文章。Returns the top news articles by category. 例如,你可以请求热门的体育或娱乐文章。For example, you can request the top sports or entertainment articles. 有关指定类别的信息,请参阅 category query 参数。For information about specifying categories, see the category query parameter.
https://api.cognitive.microsoft.com/bing/v7.0/news/search 基于用户的搜索查询返回新闻文章。Returns news articles based on the user's search query. 如果搜索查询为空,则该调用将返回热门新闻文章。If the search query is empty, the call returns the top news articles.
https://api.cognitive.microsoft.com/bing/v7.0/news/trendingtopics 返回当前在社交网络上进行趋势分析的趋势新闻主题。Returns trending news topics that are currently trending on social networks.

注意: 仅可用于 en-us 和 zh-chs 市场。NOTE: Available only in the en-US and zh-CN markets.

对于多服务订阅,必须在 URL 中包含区域。For multi-service subscriptions, you must include the region in the URL. 例如: westus.api.cognitive.microsoft.com。For example: westus.api.cognitive.microsoft.com. 请参阅 支持的区域See Supported Regions.

请求必须使用 HTTPS 协议;不支持 HTTP。The request must use the HTTPS protocol; HTTP is not supported.

备注

最大 URL 长度为 2,048 个字符。The maximum URL length is 2,048 characters. 为了确保 URL 长度不超出限制,查询参数的最大长度应不到 1,500 个字符。To ensure that your URL length does not exceed the limit, the maximum length of your query parameters should be less than 1,500 characters. 如果 URL 超出 2,048 个字符,服务器会返回“404 未找到”。If the URL exceeds 2,048 characters, the server returns 404 Not found.

标头Headers

下面是请求和响应可能包含的标头。The following are the headers that a request and response may include.

标头Header 说明Description
AcceptAccept 可选请求标头。Optional request header.

默认的媒体类型为“application/json”。The default media type is application/json. 若要指定响应使用 JSON-LD,请将 Accept 标头设置为“application/ld+json”。To specify that the response use JSON-LD, set the Accept header to application/ld+json.
Accept-LanguageAccept-Language 可选请求标头。Optional request header.

以逗号分隔的语言列表,用于用户界面字符串。A comma-delimited list of languages to use for user interface strings. 此列表以降序方式显示首选项。The list is in decreasing order of preference. 有关详细信息,包括预期格式,请参阅 RFC2616For more information, including expected format, see RFC2616.

此标头和 setLang 查询参数相互排斥—不可同时指定两者。This header and the setLang query parameter are mutually exclusive—do not specify both.

如果设置此标头,则还必须指定 cc 查询参数。If you set this header, you must also specify the cc query parameter. 为了确定针对哪个市场返回结果,必应使用从列表中找到的第一个受支持语言并将其与 cc 参数值相结合。To determine the market to return results for, Bing uses the first supported language it finds from the list and combines it with the cc parameter value. 如果列表不包括支持的语言,必应会查找最接近的语言和支持请求的市场,或将聚合或默认市场用于结果。If the list does not include a supported language, Bing finds the closest language and market that supports the request or it uses an aggregated or default market for the results. 若要确定必应使用的市场,请查看 BingAPIs-Market 标头。To determine the market that Bing used, see the BingAPIs-Market header.

仅当指定多个语言时,才可使用此标头和 cc 查询参数。Use this header and the cc query parameter only if you specify multiple languages. 否则,请使用 mktsetLang 查询参数。Otherwise, use the mkt and setLang query parameters.

用户界面字符串是用作用户界面中标签的字符串。A user interface string is a string that's used as a label in a user interface. JSON 响应对象中有几个用户界面字符串。There are few user interface strings in the JSON response objects. 响应对象中 Bing.com 属性的任何链接均将应用指定的语言。Any links to Bing.com properties in the response objects apply the specified language.
BingAPIs-MarketBingAPIs-Market 响应标头。Response header.

请求使用的市场。The market used by the request. 窗体是 <languageCode> - <countryCode> 。The form is <languageCode>-<countryCode>. 例如,en-US。For example, en-US.

如果指定市场 代码中未列出的市场,此值可能不同于在 有关 查询参数中指定的市场。If you specify a market that is not listed in Market Codes, this value may differ from the market you specified in the mkt query parameter. 如果为无法协调的 "抄送" 和 " 接受语言 " 指定值,则这一点同样适用。The same is true if you specify values for cc and Accept-Language that can't be reconciled.
BingAPIs-TraceIdBingAPIs-TraceId 响应标头。Response header.

包含请求详细信息的日志条目 ID。The ID of the log entry that contains the details of the request. 发生错误时,捕获此 ID。When an error occurs, capture this ID. 如果无法确定并解决问题,请纳入此 ID 以及提供给支持团队的其他信息。If you are not able to determine and resolve the issue, include this ID along with the other information that you provide the Support team.
Ocp-Apim-Subscription-KeyOcp-Apim-Subscription-Key 必需请求标头。Required request header.

认知服务中注册此服务时收到的订阅密钥。The subscription key that you received when you signed up for this service in Cognitive Services.
PragmaPragma 可选请求标头Optional request header

默认情况下,必应返回缓存的内容(如果适用)。By default, Bing returns cached content, if available. 若要防止缓存的内容,请将杂注标头设置为无缓存 (例如,Pragma: no-) 。To prevent cached content, set the Pragma header to no-cache (for example, Pragma: no-cache).
重试-之后Retry-After 响应标头。Response header.

如果超过了每秒 (QPS) 或每月 (QPM) 允许的查询数,则响应包括此标头。The response includes this header if you exceed the number of queries allowed per second (QPS) or per month (QPM). 标头包含在发送其他请求之前必须等待的秒数。The header contains the number of seconds that you must wait before sending another request.
User-AgentUser-Agent 可选请求标头。Optional request header.

发出请求的用户代理。The user agent originating the request. 必应使用用户代理为移动用户提供优化体验。Bing uses the user agent to provide mobile users with an optimized experience. 尽管是可选的,但还是建议始终指定此标头。Although optional, you are encouraged to always specify this header.

user-agent 应该是任何常用浏览器发送的字符串。The user-agent should be the same string that any commonly used browser sends. 有关用户代理的信息,请参阅 RFC 2616For information about user agents, see RFC 2616.

下面是 user-agent 字符串示例。The following are examples of user-agent strings.
  • Windows Phone—Mozilla/5.0(兼容;MSIE 10.0;Windows Phone 8.0;Trident/6.0;IEMobile/10.0;ARM;Touch;NOKIA;Lumia 822)Windows Phone—Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 822)

  • Android—Mozilla/5.0(Linux;U;Android 2.3.5;en-us;SCH-I500 Build/GINGERBREAD)AppleWebKit/533.1(KHTML,如 Gecko)版本/4.0 Mobile Safari/533.1Android—Mozilla/5.0 (Linux; U; Android 2.3.5; en-us; SCH-I500 Build/GINGERBREAD) AppleWebKit/533.1 (KHTML; like Gecko) Version/4.0 Mobile Safari/533.1

  • iPhone—Mozilla/5.0(iPhone;CPU iPhone OS 6_1,如 Mac OS X)AppleWebKit/536.26(KHTML;如 Gecko)Mobile/10B142 iPhone4;1 BingWeb/3.03.1428.20120423iPhone—Mozilla/5.0 (iPhone; CPU iPhone OS 6_1 like Mac OS X) AppleWebKit/536.26 (KHTML; like Gecko) Mobile/10B142 iPhone4;1 BingWeb/3.03.1428.20120423

  • PC—Mozilla/5.0(Windows NT 6.3;WOW64;Trident/7.0;Touch;rv:11.0),如 GeckoPC—Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; Touch; rv:11.0) like Gecko

  • iPad—Mozilla/5.0(iPad;CPU OS 7_0,如 Mac OS X)AppleWebKit/537.51.1(KHTML,如 Gecko)版本/7.0 Mobile/11A465 Safari/9537.53iPad—Mozilla/5.0 (iPad; CPU OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53
X-MSEdge-ClientIDX-MSEdge-ClientID 可选请求和响应标头。Optional request and response header.

必应使用此标头跨必应 API 调用为用户提供一致的行为。Bing uses this header to provide users with consistent behavior across Bing API calls. 必应通常会发布新功能和改进,并将客户端 ID 用作密钥以在不同航班上分配客流量。Bing often flights new features and improvements, and it uses the client ID as a key for assigning traffic on different flights. 如果未跨多个请求将相同的客户端 ID 用于用户,则必应可能将用户分配给多个冲突的航班。If you do not use the same client ID for a user across multiple requests, then Bing may assign the user to multiple conflicting flights. 分配给多个冲突航班可能导致用户体验不一致。Being assigned to multiple conflicting flights can lead to an inconsistent user experience. 例如,如果第二个请求与第一个请求的航班分配不同,体验可能会出现意外。For example, if the second request has a different flight assignment than the first, the experience may be unexpected. 此外,必应使用客户端 ID 将 web 结果定制为该客户端 ID 的搜索历史记录,从而为用户提供更丰富的体验。Also, Bing can use the client ID to tailor web results to that client ID's search history, providing a richer experience for the user.

通过分析由客户端 ID 生成的活动,必应还会使用此标头来提高结果排名。Bing also uses this header to help improve result rankings by analyzing the activity generated by a client ID. 相关改进有助于提高必应 API 交付的结果质量,从而提高 API 客户的点击率。The relevance improvements help with better quality of results delivered by Bing APIs and in turn enables higher click-through rates for the API consumer.

重要提示: 尽管是可选的,但应将此标头视为必选。IMPORTANT: Although optional, you should consider this header required. 对于同一最终用户和设备组合,如果跨多个请求保留客户端 ID,则 1) API 客户可以获取一致的用户体验;2) 可通过必应 API 提高结果质量,从而提高点击率。Persisting the client ID across multiple requests for the same end user and device combination enables 1) the API consumer to receive a consistent user experience, and 2) higher click-through rates via better quality of results from the Bing APIs.

下面是适用于此标头的基本用法规则。The following are the basic usage rules that apply to this header.
  • 在设备上使用你的应用程序的每个用户必须具有必应生成的唯一客户端 ID。Each user that uses your application on the device must have a unique, Bing generated client ID.

    如果未在请求中包含此标头,必应会生成 ID,然后在 X-MSEdge-ClientID 响应标头中将其返回。If you do not include this header in the request, Bing generates an ID and returns it in the X-MSEdge-ClientID response header. 仅当用户首次在设备上使用应用时,才不可以在请求中包含此标头。The only time that you should NOT include this header in a request is the first time the user uses your app on that device.

  • 注意: 必须确保此客户端 ID 不能链接到任何可以进行身份验证的用户帐户信息。ATTENTION: You must ensure that this Client ID is not linkable to any authenticatable user account information.

  • 针对应用为设备上的此用户生成的每个必应 API 请求,使用客户端 ID。Use the client ID for each Bing API request that your app makes for this user on the device.

  • 保留客户端 ID。Persist the client ID. 若要在浏览器应用中保留 ID,请使用持久性 HTTP Cookie 来确保所有会话均使用此 ID。To persist the ID in a browser app, use a persistent HTTP cookie to ensure the ID is used across all sessions. 请勿使用会话 Cookie。Do not use a session cookie. 对于移动应用等其他应用,请使用设备的持久存储来保留 ID。For other apps such as mobile apps, use the device's persistent storage to persist the ID.

    下次用户在该设备上使用你的应用时,会获取保留的客户端 ID。The next time the user uses your app on that device, get the client ID that you persisted.

注意: 必应响应不一定包含此标头。NOTE: Bing responses may or may not include this header. 如果响应包含此标头,请针对该设备上的用户捕获客户端 ID 并将其用于所有后续必应请求。If the response includes this header, capture the client ID and use it for all subsequent Bing requests for the user on that device.

注意: 如果包含 X-MSEdge-ClientID,不可在请求中包含 Cookie。NOTE: If you include the X-MSEdge-ClientID, you must not include cookies in the request.
X-MSEdge-ClientIPX-MSEdge-ClientIP 可选请求标头。Optional request header.

客户端设备的 IPv4 或 IPv6 地址。The IPv4 or IPv6 address of the client device. IP 地址用于发现用户的位置。The IP address is used to discover the user's location. 必应使用位置信息来确定安全搜索行为。Bing uses the location information to determine safe search behavior.

注意: 尽管是可选的,但还是建议始终指定此标头和 X-Search-Location 标头。NOTE: Although optional, you are encouraged to always specify this header and the X-Search-Location header.

不要混淆地址(例如,通过将最后一个八位字节更改为 0 来混淆地址)。Do not obfuscate the address (for example, by changing the last octet to 0). 混淆地址会导致位置未处于设备实际位置附近,这可能导致必应提供错误的结果。Obfuscating the address results in the location not being anywhere near the device's actual location, which may result in Bing serving erroneous results.
X-Search-LocationX-Search-Location 可选请求标头。Optional request header.

以分号分隔的键/值对列表,描述客户端的地理位置。A semicolon-delimited list of key/value pairs that describe the client's geographical location. 必应使用位置信息来确定安全搜索行为并返回相关的本地内容。Bing uses the location information to determine safe search behavior and to return relevant local content. 将键/值对指定为 <key> : <value> 。Specify the key/value pair as <key>:<value>. 下面是用于指定用户位置的键。The following are the keys that you use to specify the user's location.

  • lat—必需。lat—Required. 客户位置的纬度,以度为单位。The latitude of the client's location, in degrees. 纬度必须大于或等于 -90.0 且小于或等于 +90.0。The latitude must be greater than or equal to -90.0 and less than or equal to +90.0. 负值表示南纬,正值表示北纬。Negative values indicate southern latitudes and positive values indicate northern latitudes.

  • long—必需。long—Required. 客户位置的经度,以度为单位。The longitude of the client's location, in degrees. 经度必须大于或等于 -180.0 且小于或等于 +180.0。The longitude must be greater than or equal to -180.0 and less than or equal to +180.0. 负值表示西经,正值表示东经。Negative values indicate western longitudes and positive values indicate eastern longitudes.

  • re—必需。re—Required. 半径(以米为单位),指定坐标的水平准确性。The radius, in meters, which specifies the horizontal accuracy of the coordinates. 传递设备定位服务返回的值。Pass the value returned by the device's location service. 典型的值可能是:22m - GPS/Wi-Fi、380m - 蜂窝基站三角网定位、18,000m - 反向 IP 查询。Typical values might be 22m for GPS/Wi-Fi, 380m for cell tower triangulation, and 18,000m for reverse IP lookup.

  • ts—可选。ts—Optional. 客户位于相应位置时的 UTC UNIX 时间戳。The UTC UNIX timestamp of when the client was at the location. (UNIX 时间戳是自 1970 年 1 月 1 日起的秒数。)(The UNIX timestamp is the number of seconds since January 1, 1970.)

  • head—可选。head—Optional. 客户端的相对航向或旅行方向。The client's relative heading or direction of travel. 以度数指定旅行方向(从 0 到 360),相对于正北方向顺时针计数。Specify the direction of travel as degrees from 0 through 360, counting clockwise relative to true north. 如果 sp 键为非零值,则指定此键。Specify this key only if the sp key is nonzero.

  • sp—可选。sp—Optional. 客户设备移动的水平速度(速度),以米/秒为单位。The horizontal velocity (speed), in meters per second, that the client device is traveling.

  • alt—可选。alt—Optional. 客户设备的高度,以米为单位。The altitude of the client device, in meters.

  • are—可选。are—Optional. 半径(以米为单位),指定坐标的垂直准确度。The radius, in meters, that specifies the vertical accuracy of the coordinates. 只有在指定 alt 键的情况下才指定此键。Specify this key only if you specify the alt key.

  • 为 — 可选。disp—Optional. 用户的地理位置,格式为: <City、State>。The user's geographic location in the form, disp:<City, State>. 例如,在华盛顿州的西雅图。For example, disp:Seattle, Washington. 这是使用 lat/long 键指定的用户位置的显示文本版本。This is the display text version of the user's location that you specified using the lat/long keys. 如果此值与 lat/长坐标冲突,必应使用 "指示" 值作为用户的位置。If this value conflicts with the lat/long coordinates, Bing uses the disp value as the user's location.

注意: 如果查询包含位置,必应忽略此标头。NOTE: Bing ignores this header if the query includes a location. 例如,如果此标头将用户的位置反映为旧金山,但该查询是 餐馆西雅图 ,必应返回位于华盛顿州西雅图的餐厅。For example, if this header reflects the user's location as San Francisco, but the query is restaurants seattle , Bing returns restaurants located in Seattle, Washington.

注意: 尽管许多键是可选的,但提供的信息越多,位置结果越精确。NOTE: Although many of the keys are optional, the more information that you provide, the more accurate the location results are.

注意: 尽管是可选的,但还是建议始终指定用户的地理位置。NOTE: Although optional, you are encouraged to always specify the user's geographical location. 如果客户端的 IP 地址未准确反映用户的物理位置(例如,如果客户端使用 VPN),则提供位置尤其重要。Providing the location is especially important if the client's IP address does not accurately reflect the user's physical location (for example, if the client uses VPN). 为获得最佳结果,应包括此标头和 ClientIP 标头,但至少应包括此标头。For optimal results, you should include this header and the X-Search-ClientIP header, but at a minimum, you should include this header.

备注

请记住,使用条款要求遵守所有适用的法律,包含这些标头的用法。Remember that the Terms of Use require compliance with all applicable laws, including regarding use of these headers. 例如,在某些管辖区(如欧洲),在用户设备上放置某些跟踪设备之前,需要获得用户同意。For example, in certain jurisdictions, such as Europe, there are requirements to obtain user consent before placing certain tracking devices on user devices.

查询参数Query parameters

以下是请求可能包含的查询参数。The following are the query parameters that the request may include. “必需”列指示是否必须指定参数 。The Required column indicates whether you must specify the parameter. 必须对查询参数值进行 URL 编码。You must URL encode the query parameter values.

名称Name Value 类型Type 必需Required
cccc 结果来源的国家/地区的 2 个字符国家/地区代码。A 2-character country code of the country where the results come from. 有关可能值的列表,请参阅 市场代码For a list of possible values, see Market Codes.

如果设置此参数,则还必须指定 Accept-language 标头。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.

Accept-Language仅当指定多种语言时,才使用此查询参数和标头。Use this query parameter and the Accept-Language header only if you specify multiple languages. 否则,应使用 mktsetLang 查询参数。Otherwise, you should use the mkt and setLang query parameters.

此参数和 mkt 查询参数相互排斥—不可同时指定两者。This parameter and the mkt query parameter are mutually exclusive—do not specify both.
StringString No
类别category 要返回的项目的类别。The category of articles to return. 例如,体育文章或娱乐文章。For example, Sports articles or Entertainment articles. 有关可能类别的列表,请参阅 按市场列出的新闻类别For a list of possible categories, see News Categories by Market.

仅将此参数用于新闻类别请求 (参阅/news 终结点) 。Use this parameter only with news category requests (see the /news endpoint).

如果未指定此参数,则响应包括:If you do not specify this parameter, the response includes both:
  • 通常在最近24小时内从任何类别发布的标题文章,但一些文章可能会更早。Headline articles typically published in the last 24 hours from any category, but some articles may be older.

    如果项目是标题,则项目的 " 标题 " 字段设置为 " true "。If the article is a headline, the article's headline field is set to true . 默认情况下,响应包括最多12个大字标题文章和分类。By default, the response includes up to 12 headline articles and clusters. 若要指定要返回的标题项目数,请设置 headlineCount 查询参数。To specify the number of headline articles to return, set the headlineCount query parameter.

  • 每个父类别的文章从每个类别) (最多四篇文章和分类。Articles from each parent category (up to four articles and clusters from each category).

如果未指定, headlineCount 并且市场支持8个类别,则响应最多包括44个文章和群集 (12 个新闻文章和群集,以及32个特定于类别的文章和群集) 。If you do not specify headlineCount and the market supports eight categories, the response includes up to 44 articles and clusters (12 headline articles and clusters plus 32 category-specific articles and clusters). 由于一个群集包含多个项目,因此,此示例中的项目数44可能更多。Because a cluster contains more than one article, the number of articles in this example, 44, could be more. 例如,响应可能包含11个新闻文章和一个分类,其中包含四个相关的新闻文章,共15个新闻文章。For example, the response may include 11 headline articles and one cluster, which contains four related headline articles for a total of 15 headline articles.
StringString No
countcount 要在响应中返回的新闻项目的数量。The number of news articles to return in the response. 提供的实际结果数可能小于请求获取的结果数。The actual number delivered may be less than requested. 默认值为10,最大值为100。The default is 10 and the maximum value is 100.

对于趋势主题,默认值为 "所有趋势新闻" 主题 (大约55个文章) 。For trending topics, the default is all trending news topics (approximately 55 articles).

可以将此参数与参数一起用于 offset 页面结果。You may use this parameter along with the offset parameter to page results. 例如,如果用户界面每页显示20个项目,则将设置 count 为20,将设置为 offset 0,以获取结果的第一页。For example, if your user interface displays 20 articles per page, set count to 20 and offset to 0 to get the first page of results. 对于每个后续页面,增加 offset 20 个 (例如,0、20、40) 。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.

注意: 群集被计为单个项。NOTE: Clusters are counted as a single item. 例如,如果将计数设置为10,则响应可能包括9个文章和1个分类,但群集可能包含5个文章。For example, if you set the count to 10, the response may include 9 articles and 1 cluster but the cluster may contain 5 articles.

注意: 如果请求的是新闻类别,请仅在指定 category 参数时才指定此参数。NOTE: If you're requesting news categories, specify this parameter only if you specify the category parameter. 如果未指定 category 参数,必应忽略此参数。If you do not specify the category parameter, Bing ignores this parameter.
UnsignedShortUnsignedShort No
时效性freshness 按以下 age 值筛选新闻文章:Filter news articles by the following age values:
  • 在 — 最近24小时内返回必应发现的新闻文章Day—Return news articles that Bing discovered within the last 24 hours
  • 在 — 过去7天内,周返回必应发现的新闻文章Week—Return news articles that Bing discovered within the last 7 days
  • 在 — 过去30天内必应发现的月份返回新闻文章Month—Return news articles that Bing discovered within the last 30 days
StringString No
headlineCountheadlineCount 要返回的标题文章和分类的数目。The number of headline articles and clusters to return. 默认值为 12。The default is 12.

仅当未指定 category 参数时才指定此参数。Specify this parameter only if you do not specify the category parameter. 如果指定 category 参数,必应忽略此参数。If you specify the category parameter, Bing ignores this parameter.

仅将此参数与新闻类别请求一起使用。Use this parameter only with news category requests.
UnsignedShortUnsignedShort No
mktmkt 产生结果的市场。The market where the results come from. 通常, mkt 是用户从中发出请求的国家/地区。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. 市场必须采用形式 <language code> - <country code> 。The market must be in the form <language code>-<country code>. 例如,en-US。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.

此参数和 cc 查询参数相互排斥—不可同时指定两者。This parameter and the cc query parameter are mutually exclusive—do not specify both.
StringString No
offsetoffset 从零开始的偏移量,它指示在返回项目前要跳过的新闻文章的数目。The zero-based offset that indicates the number of news articles to skip before returning articles. 默认值为 0。The default is 0. 偏移量应小于 (totalEstimatedMatches - count) 。The offset should be less than (totalEstimatedMatches - count).

将此参数与参数一起用于 count 页面结果。Use this parameter along with the count parameter to page results. 例如,如果用户界面每页显示20个项目,则将设置 count 为20,将设置为 offset 0,以获取结果的第一页。For example, if your user interface displays 20 articles per page, set count to 20 and offset to 0 to get the first page of results. 对于每个后续页面,增加 offset 20 个 (例如,0、20、40) 。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.

注意: 群集被计为单个项。NOTE: Clusters are counted as a single item. 例如,如果将计数设置为10,则响应可能包括9个文章和1个分类,但群集可能包含5个文章。For example, if you set the count to 10, the response may include 9 articles and 1 cluster but the cluster may contain 5 articles.

注意: 如果请求新闻类别,则仅在指定 category 参数时才指定此参数。NOTE: If requesting news categories, specify this parameter only if you specify the category parameter. 如果未指定 category 参数,必应忽略此参数。If you do not specify the category parameter, Bing ignores this parameter.
无符号短Unsigned Short No
originalImgoriginalImg 一个布尔值,确定图像的是否 contentUrl 包含指向原始项目的图像的缩略图或图像本身的 URL。A Boolean value that determines whether the image's contentUrl contains a URL that points to a thumbnail of the original article's image or the image itself.

如果项目包含一个图像,并且此参数设置为 true ,则图像的属性将 contentUrl 包含一个 URL,您可以使用该 URL 从发布者的网站下载原始图像。If the article includes an image, and this parameter is set to true , the image's contentUrl property contains a URL that you may use to download the original image from the publisher's website. 否则,如果此参数为 false ,则图像的 contentUrlthumbnailUrl url 都指向相同的缩略图。Otherwise, if this parameter is false , the image's contentUrl and thumbnailUrl URLs both point to the same thumbnail image.

默认值为 false。The default is false.

仅将此参数用于新闻搜索 API。Use this parameter only with the News Search API. 调用 Web 搜索 API 时,请不要指定此参数。Do not specify this parameter when calling the Web Search API. 趋势主题忽略此参数。Trending Topics ignores this parameter.
布尔Boolean No
qq 用户的搜索查询词。The user's search query term. 如果字词为空 (例如,q =) ,则响应包括热门新闻报道。If the term is empty (for example, q=), the response includes the top news stories.

术语字符串可能包含 必应高级运算符The term string may contain Bing Advanced Operators. 例如,若要将新闻限制为特定域,请使用 site: operator。For example, to limit news to a specific domain, use the site: operator.

如果按类别获取新闻文章,请不要包含此参数。If you're getting news articles by category, do not include this parameter. 趋势主题忽略此参数。Trending Topics ignores this parameter.
StringString Yes
safeSearchsafeSearch 筛选成人内容的新闻文章。Filter news articles for adult content. 下面是可能的筛选器值。The following are the possible filter 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.

注意: 如果请求来自必应成人策略要求将 safeSearch 设置为“严格”的某一市场,必应会忽略 safeSearch 值并使用“严格”。NOTE: If the request comes from a market that Bing's adult policy requires that safeSearch is set to Strict, Bing ignores the safeSearch value and uses Strict.
StringString No
setLangsetLang 可用于用户界面字符串的语言。The language to use for user interface strings. 您可以使用两个字母或四个字母的代码指定语言。You may specify the language using either a 2-letter or 4-letter code. 首选使用4字母代码。Using 4-letter codes is preferred.

有关支持的语言代码的列表,请参阅 必应支持的语言For a list of supported language codes, see Bing supported languages.

必应加载本地化的字符串(如果 setlang 包含有效的2字母非特定区域性代码 ( Fr ) 或 ( fr-ca ) 的有效的4字母特定区域性代码。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 ). 例如,对于 fr-ca ,必应加载 fr-fr 区域性代码字符串。For example, for fr-ca , Bing loads the fr neutral culture code strings.

setlang例如,如果不是有效 (例如, Zh-chs ) 或必应不支持该语言 (例如, afAf-na ) ,必应默认为 en (英语) 。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).

若要指定2字母代码,请将此参数设置为 ISO 639-1 语言代码。To specify the 2-letter code, set this parameter to an ISO 639-1 language code.

若要指定4个字母的代码,请使用格式 <国家/地区> 其中 是 (非特定区域性的 iso 639-1 语言代码) ,<国家/地区> 是特定区域性 (代码的 iso 3166 国家/地区。To specify the 4-letter code, use the form -<country/region> where is an ISO 639-1 language code (neutral culture) and <country/region> is an ISO 3166 country/region (specific culture) code. 例如,使用 en-us 作为美国英语。For example, use en-US for United States English.

尽管是可选项,但应始终指定语言。Although optional, you should always specify the language. 通常情况下,请将 setLang 设置为 mkt 所指定的语言,除非用户希望以另一语言显示用户界面字符串。Typically, you set setLang to the same language specified by mkt unless the user wants the user interface strings displayed in a different language.

此参数和 Accept-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. JSON 响应对象中有几个用户界面字符串。There are few user interface strings in the JSON response objects. 此外,响应对象中 Bing.com 属性的任何链接均会应用指定的语言。Also, any links to Bing.com properties in the response objects apply the specified language.
StringString No
sincesince Unix 时期 (应使用的 Unix 时间戳) 来选择趋势主题。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.

若要使用此参数,还需要指定 sortBy 参数。To use this parameter, also specify the sortBy parameter.
IntegerInteger No
sortBysortBy 要在其中返回趋势主题的顺序。The order to return the trending topics in. 下面是可能的不区分大小写的值。The following are the possible case-insensitive values.
  • Date — 返回按日期从最新到最旧的顺序排序的趋势主题Date—Returns trending topics sorted by date from the most recent to the oldest

如果未指定此参数,则没有特定排序。If you do not specify this parameter, there is no specific ordering. 但考虑到了主题新鲜度、category、global user engagement 和个性化功能。However, topic freshness, category, global user engagement, and personalized features are taken into account.
StringString No
textDecorationstextDecorations 确定显示字符串是否应包含装饰标记(如命中突出显示字符)的布尔值。A Boolean value that determines whether display strings should contain decoration markers such as hit highlighting characters. 如果 为 true ,则字符串可能包含标记。If true , the strings may include markers. 默认值为 falseThe default is false .

若要指定是否使用 Unicode 字符或 HTML 标记作为标记,请参阅 textFormat 查询参数。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
textFormattextFormat 用于文本修饰的标记的类型 (参阅 textDecorations query 参数) 。The type of markers to use for text decorations (see the textDecorations query parameter).

下面是可能的值。The following are the possible values.
  • Raw — 使用 Unicode 字符标记需要特殊格式的内容。Raw—Use Unicode characters to mark content that needs special formatting. Unicode 字符在 E000 到 E019 的范围内。The Unicode characters are in the range E000 through E019. 例如,必应使用 E000 和 E001 来标记查询词的开始和结束以进行命中突出显示。For example, Bing uses E000 and E001 to mark the beginning and end of query terms for hit highlighting.

  • HTML — 使用 html 标记来标记需要特殊格式的内容。HTML—Use HTML tags to mark content that needs special formatting. 例如,使用 <b> 标记在显示字符串中突出显示查询词。For example, use <b> tags to highlight query terms in display strings.

默认值为 Raw。The default is Raw.

有关标记的列表,请参阅 命中突出显示For a list of markers, see Hit Highlighting.

对于包含 escapable HTML 字符(如 <、> 和 &)的显示字符串,如果将 textFormat 设置为 HTML,必应根据需要对字符进行转义 (例如,< 转义为 & lt; ) 。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;).

有关处理嵌入的 Unicode 字符的字符串的信息,请参阅 命中突出显示For information about processing strings with embedded Unicode characters, see Hit Highlighting.
StringString No

响应对象Response objects

备注

为了遵从法国的新欧盟版权指令,必应 Web、新闻、视频、图像和所有自定义搜索 Api 必须省略法语用户的某些欧盟新闻源中的某些内容。To comply with the new EU Copyright Directive in France, the Bing Web, News, Video, Image and all Custom Search APIs must omit some content from certain EU News sources for French users. 删除的内容可能包括缩略图图像和视频、视频预览以及从这些源搜索结果的代码段。The removed content may include thumbnail images and videos, video previews, and snippets which accompany search results from these sources. 因此,必应 Api 可以使用缩略图图像和视频、视频预览和法语,为法语用户提供更少的结果。As a consequence, the Bing APIs may serve fewer results with thumbnail images and videos, video previews, and snippets to French users.

下面是响应可能包含的 JSON 对象。The following are the JSON objects that the response may include. 如果请求成功,则响应中的顶层对象是 News 对象(如果终结点是/news/search 或/news),如果终结点为/news/trendingtopics.,则为 TrendingTopicAnswerIf the request succeeds, the top-level object in the response is the News object if the endpoint is /news/search or /news, and TrendingTopicAnswer if the endpoint is /news/trendingtopics. 如果请求失败,则顶级对象为 ErrorResponse 对象。If the request fails, the top-level object is the ErrorResponse object.

对象Object 描述Description
错误Error 定义发生的错误。Defines an error that occurred.
ErrorResponseErrorResponse 定义响应在请求失败时包含的顶级对象。Defines the top-level object that the response includes when the request fails.
映像Image 定义与新闻相关的图像的缩略图。Defines a thumbnail of a news-related image.
MediaSizeMediaSize 定义媒体内容的大小。Defines the size of the media content.
新闻News 定义当新闻请求成功时,响应包括的顶级对象。Defines the top-level object that the response includes when the news request succeeds.
NewsArticleNewsArticle 定义新闻文章。Defines a news article.
组织Organization 定义运行项目的提供程序。Defines the provider that ran the article.
查询Query 定义搜索查询字符串。Defines the search query string.
RelatedTopicRelatedTopic 定义与搜索查询相关的新闻文章的列表。Defines a list of news articles that are related to the search query.
缩略图Thumbnail 定义指向相关图像的链接。Defines a link to the related image.
主题Topic 定义趋势新闻主题。Defines a trending news topic.
TrendingTopicsTrendingTopics 定义当趋势主题请求成功时,响应包括的顶级对象。Defines the top-level object that the response includes when the trending topics request succeeds.
视频定义与新闻文章相关的视频。VideoDefines a video that's related to the news article.

错误Error

定义已发生的错误。Defines the error that occurred.

元素Element 说明Description 类型Type
codecode 用于标识错误类别的错误代码。The error code that identifies the category of error. 如需可能的代码的列表,请参阅错误代码For a list of possible codes, see Error Codes. StringString
messagemessage 对错误的说明。A description of the error. StringString
moreDetailsmoreDetails 一个说明,提供关于错误的其他信息。A description that provides additional information about the error. StringString
parameterparameter 请求中导致错误的查询参数。The query parameter in the request that caused the error. StringString
subCodesubCode 用于标识错误的错误代码。The error code that identifies the error. 例如,如果 code 为 InvalidRequest,则 subCode 可以为 ParameterInvalid 或 ParameterInvalidValue。For example, if code is InvalidRequest, subCode may be ParameterInvalid or ParameterInvalidValue. StringString
valuevalue 查询参数的无效值。The query parameter's value that was not valid. StringString

ErrorResponseErrorResponse

请求失败时响应包含的顶级对象。The top-level object that the response includes when the request fails.

“属性”Name Value 类型Type
_type_type 类型提示。Type hint. StringString
errorserrors 错误的列表,用于说明请求失败原因。A list of errors that describe the reasons why the request failed. 错误[]Error[]

映像Image

定义与新闻相关的图像的缩略图。Defines a thumbnail of a news-related image.

“属性”Name Value 类型Type
providerprovider 映像的所有者列表。A list of owners of the image. 组织Organization
thumbnailthumbnail 指向图像的缩略图的链接。A link to a thumbnail of the image. 缩略图Thumbnail
urlurl 图像的 URL。The URL to the image. StringString

MediaSizeMediaSize

定义媒体内容的大小。Defines the size of the media content.

“属性”Name Value 类型Type
高度height 媒体内容的高度(以像素为单位)。The height of the media content, in pixels. IntegerInteger
widthwidth 媒体内容的宽度(以像素为单位)。The width of the media content, in pixels. IntegerInteger

新闻News

定义当新闻请求成功时,响应包括的顶级对象。Defines the top-level object that the response includes when the news request succeeds.

如果服务怀疑发生拒绝服务攻击,请求会成功 (HTTP 状态代码为 200 OK) ,但响应正文为空。If the service suspects a denial of service attack, the request succeeds (HTTP status code is 200 OK), but the body of the response is empty.

“属性”Name Value 类型Type
_type_type 类型提示。Type hint. StringString
idid 唯一标识新闻答案的 ID。An ID that uniquely identifies the news answer.

有关如何使用此字段的信息,请参阅 使用排名显示 Web 搜索 API 指南中的结果。For information about how to use this field, see Using Ranking to Display Results in the Web Search API guide.
StringString
readLinkreadLink 返回此答案的 URL。The URL that returns this answer. 若要使用 URL,请根据需要追加查询参数,并包括 Apim-- Key 标头。To use the URL, append query parameters as appropriate and include the Ocp-Apim-Subscription-Key header.

Web 搜索 API 包括此字段。The Web Search API includes this field. 通常,如果要直接查询新闻搜索 API,则可以使用 URL。Typically, you'd use the URL if you want to query the News Search API directly.
StringString
relatedTopicsrelatedTopics 与搜索词相关的新闻文章的列表。A list of news articles that are related to the search term. RelatedTopic[]RelatedTopic[]
进行sort 新闻文章排序选项的列表。A list of options for sorting the news articles. 例如,按相关性 (默认) 或日期排序。For example, sort by relevance (default) or date. 若要确定请求使用的排序顺序,请参阅 isSelected 字段。To determine which sort order the request used, see the isSelected field. SortValue[]SortValue[]
totalEstimatedMatchestotalEstimatedMatches 与查询相关的新闻文章的估计数目。The estimated number of news articles that are relevant to the query. 将此数字与 计数偏移 查询参数一起使用,以对结果进行分页。Use this number along with the count and offset query parameters to page the results.

只有新闻搜索 API 包括此字段 (Web 搜索 API 不) 。Only the News Search API includes this field (the Web Search API does not).
LongLong
valuevalue 与查询字词相关的新闻文章的列表。A list of news articles that are relevant to the query term.

如果请求没有要返回的结果,则数组为空。If there are no results to return for the request, the array is empty.
NewsArticle[]NewsArticle[]

NewsArticleNewsArticle

定义新闻文章。Defines a news article.

“属性”Name Value 类型Type
类别category 项目所属的新闻类别。The news category that the article belongs to. 例如,体育。For example, Sports. 如果无法确定新闻类别,则项目不包含此字段。If the news category cannot be determined, the article does not include this field.

有关可能类别的列表,请参阅 按市场列出的新闻类别For a list of possible categories, see News Categories by Market.

如果您的请求指定了 Sports-Tennis 类别,则该 category 属性可能包含 Sports-Tennis 或运动。If your request specifies the Sports-Tennis category, the category property may contain Sports-Tennis or Sports.
StringString
clusteredArticlesclusteredArticles 相关新闻文章的列表。A list of related news articles. NewsArticle[]NewsArticle[]
contractualRulescontractualRules 显示项目时必须遵守的规则的列表。A list of rules that you must adhere to if you display the article. 例如,规则可以控制是否必须提供归属。For example, the rules may govern whether you must provide attribution.

可以应用以下协定规则。The following contractual rules may apply.

如果文章提供了合同规则,则必须遵守这些规则。If the article provides contractual rules, you must abide by them.

注意: 只有 WEB 搜索 API 返回的项目包含合同规则。NOTE: Only articles returned by the Web Search API contains contractual rules. 新闻终结点返回的项目不包括合同规则。Articles returned by the News endpoints do not include contractual rules.
Object []Object[]
datePublisheddatePublished 必应发现项目的日期和时间。The date and time that Bing discovered the article. 日期的格式为 YYYY-MM-DD-YYYY-MM-DDTHH: MM: SS。The date is in the format, YYYY-MM-DDTHH:MM:SS. StringString
2008description 新闻文章的简短说明。A short description of the news article. StringString
标题headline 指示新闻文章是否为标题的布尔值。A Boolean value that indicates whether the news article is a headline. 如果 为 true ,则项目是一个标题。If true , the article is a headline.

注意: 本文仅针对未指定 类别 查询参数的新闻类别请求包括此字段。NOTE: The article includes this field only for news categories requests that do not specify the category query parameter.
布尔Boolean
idid 在项目列表中唯一标识此项目的 ID。An ID that uniquely identifies this article in the list of articles.

有关如何使用此字段的信息,请参阅 使用排名显示 Web 搜索 API 指南中的结果。For information about how to use this field, see Using Ranking to Display Results in the Web Search API guide.
StringString
imageimage 与新项目关联的图像。An image related to the new article.

Image此上下文中的对象只包含 thumbnail 字段。The Image object in this context contains only the thumbnail field.
映像Image
简要mentions 本文中所述) (位置或人员的实体列表。A list of entities (places or persons) mentioned in the article. 事情[]Thing[]
路径名name 项目的名称。The name of the article.

将此名称与 URL 一起使用以创建一个超链接,单击该超链接时,会将用户转到新闻文章。Use this name along with the URL to create a hyperlink that when clicked takes the user to the news article.
StringString
程序provider 运行项目的提供程序的列表。A list of providers that ran the article. 组织[]Organization[]
链接url 新闻文章的 URL。The URL to the news article.

将此 URL 与结合使用 name 以创建一个超链接,单击该超链接时,会将用户转到新闻文章。Use this URL along with name to create a hyperlink that when clicked takes the user to the news article.
StringString
显示video 与新闻文章相关的视频。A video that's related to the news article. 视频Video

组织Organization

定义运行项目的提供程序。Defines the provider that ran the article.

“属性”Name Value 类型Type
_type_type 类型提示。Type hint. StringString
namename 运行项目的提供程序的名称。The name of the provider that ran the article. StringString

查询Query

定义搜索查询字符串。Defines the search query string.

“属性”Name Value 类型Type
texttext 返回趋势主题的查询字符串。A query string that returns the trending topic. StringString

RelatedTopicRelatedTopic

定义与搜索查询相关的新闻文章的列表。Defines a list of news articles that are related to the search query.

“属性”Name Value 类型Type
relatedNewsrelatedNews 相关新闻文章的列表。A list of related news articles. NewsArticleNewsArticle
路径名name 返回相关新闻文章的相关查询字词。The related query term that returned the related news articles. StringString
webSearchUrlwebSearchUrl 将用户转到相关查询的必应搜索结果的 URL。The URL that takes the user to the Bing search results for the related query. StringString

SortValueSortValue

定义要用于请求的排序顺序。Defines a sort order to use for the request.

“属性”Name Value 类型Type
idid 标识项目排序顺序的标识符。An identifier that identifies the articles sort order. 下面是可能的值。The following are the possible values.
  • 日期 — 排序(按日期排序)date—Sort by date
  • 相关性 — 排序(按相关性排序)relevance—Sort by relevance
StringString
isSelectedisSelected 确定响应是否使用此排序顺序的布尔值。A Boolean value that determines whether the response used this sort order. 如果 为 true ,则响应使用此排序顺序。If true , the response used this sort order. 布尔Boolean
namename 排序顺序的显示名称。The display name of the sort order. StringString
urlurl 一个 URL,可用于通过此排序顺序发出相同的请求。A URL that you can use to make the same request using this sort order. StringString

TextAttributionTextAttribution

定义纯文本属性的协定规则。Defines a contractual rule for plain text attribution.

“属性”Name Value 类型Type
_type_type 一种类型提示,设置为 TextAttribution。A type hint, which is set to TextAttribution. StringString
texttext 属性文本。The attribution text.

文本归属作为一个整体应用于新闻文章,应立即显示在文章的演示文稿之后。Text attribution applies to the news article as a whole and should be displayed immediately following the article's presentation. 如果有多个文本或链接属性规则未指定目标,则应将它们连接起来,并使用“数据来自: ”标签来显示它们。If there are multiple text or link attribution rules that do not specify a target, you should concatenate them and display them using a "Data from: " label.
StringString

ThingThing

定义项目提到的实体。Defines an entity that the article mentions.

“属性”Name Value 类型Type
namename 项目提到的实体的名称。The name of the entity that the article mentions. StringString

缩略图Thumbnail

定义指向相关图像的链接。Defines a link to the related image.

“属性”Name Value 类型Type
contentUrlcontentUrl 图像的 URL。The URL to the image. StringString
高度height 图像的高度(以像素为单位)。The height of the image, in pixels. 无符号短Unsigned Short
宽度width 图像的宽度(以像素为单位)。The width of the image, in pixels. 无符号短Unsigned Short

主题Topic

定义趋势新闻主题。Defines a trending news topic.

“属性”Name Value 类型Type
imageimage 指向相关图像的链接。A link to a related image.

Image此上下文中的对象仅包含 urlprovider 字段。The Image object in this context contains only the url and provider field. provider字段是组织对象的数组,这些对象标识映像提供程序。The provider field is an array of Organization objects that identify the image providers.
映像Image
isBreakingNewsisBreakingNews 指示主题是否被视为突发新闻的布尔值。A Boolean value that indicates whether the topic is considered breaking news. 如果该主题被视为突发新闻,则该值为 trueIf the topic is considered breaking news, the value is true . 布尔Boolean
路径名name 趋势主题的标题。The title of the trending topic. StringString
newsSearchUrlnewsSearchUrl 搜索查询词的必应新闻搜索结果的 URL (参阅 query 字段) 。The URL to the Bing News search results for the search query term (see the query field). StringString
queryquery 返回此趋势主题的搜索查询字词。A search query term that returns this trending topic. 查询Query
webSearchUrlwebSearchUrl 搜索查询词的必应搜索结果的 URL (查看 query 字段) 。The URL to the Bing search results for the search query term (see the query field). StringString

TrendingTopicsTrendingTopics

定义当趋势主题请求成功时,响应包括的顶级对象。Defines the top-level object that the response includes when the trending topics request succeeds.

“属性”Name Value 类型Type
valuevalue 必应的趋势新闻主题列表。A list of trending news topics on Bing.

如果请求没有要返回的结果,则数组为空。If there are no results to return for the request, the array is empty.
主题[]Topic[]

视频Video

定义与新闻文章相关的视频。Defines a video that's related to the news article.

备注

由于 URL 格式和参数如有更改,恕不另行通知,请按原样使用所有 Url。Because the URL format and parameters are subject to change without notice, use all URLs as-is. 不应对 URL 格式或参数执行依赖关系。You should not take dependencies on the URL format or parameters.

“属性”Name Value 类型Type
allowHttpsEmbedallowHttpsEmbed 一个布尔值,该值确定是否可以嵌入视频 (查看 embedHtml 使用 HTTPS 协议的页上的字段) 。A Boolean value that determines whether you may embed the video (see the embedHtml field) on pages that use the HTTPS protocol. 布尔Boolean
embedHtmlembedHtml 允许你在网页中嵌入并运行视频的 iframe。An iframe that lets you embed and run the video in your webpage. StringString
motionThumbnailUrlmotionThumbnailUrl 显示视频预览的动画缩略图的 URL。The URL to an animated thumbnail that shows a preview of the video. 通常,当用户在结果页上 mouses 视频的缩略图时,可以使用此 URL 播放视频的预览。Typically, you would use this URL to play a preview of the video when the user mouses over the thumbnail of the video on your results page. StringString
namename 视频的名称。The name of the video. StringString
形式thumbnail 缩略图图像或动画缩略图的宽度和高度。The width and height of the thumbnail image or motion thumbnail. MediaSizeMediaSize
thumbnailUrlthumbnailUrl 视频的缩略图图像的 URL。The URL to a thumbnail image of the video. 有关调整图像大小的信息,请参阅 调整大小和裁剪缩略图图像For information about resizing the image, see Resize and crop thumbnail images. StringString

按市场分类的新闻类别News Categories by Market

下面是可以将 类别 查询参数设置为的可能的新闻类别。The following are the possible news categories that you may set the category query parameter to. 你可以设置 category 为父类别,如娱乐或它的某个子类别,如 Entertainment_MovieAndTV。You may set category to a parent category such as Entertainment or one of its subcategories such as Entertainment_MovieAndTV. 如果将设置 category 为父类别,则它将包含一个或多个子类别中的项目。If you set category to a parent category, it includes articles from one or more of its subcategories. 如果将设置 category 为子类别,则它仅包含子类别中的项目。If you set category to a subcategory, it includes articles only from the subcategory.

市场Market 支持的类别Supported Categories
澳大利亚 (zh-cn) Australia (en-AU)
  • 澳大利亚Australia
  • Microsoft StoreBusiness
  • 娱乐Entertainment
  • 政治Politics
  • 体育游戏Sports
  • WorldWorld
加拿大 (en CA) Canada (en-CA)
  • Microsoft StoreBusiness
  • 加拿大Canada
  • 娱乐Entertainment
  • 生活方式LifeStyle
  • 政治Politics
  • ScienceAndTechnologyScienceAndTechnology
  • 体育游戏Sports
  • WorldWorld
中国 (zh-chs-CN) China (zh-CN)
  • 自动Auto
  • Microsoft StoreBusiness
  • 中国China
  • 教育Education
  • 娱乐Entertainment
  • 军用Military
  • RealEstateRealEstate
  • ScienceAndTechnologyScienceAndTechnology
  • 协会Society
  • 体育游戏Sports
  • WorldWorld
印度 (en) India (en-IN)
  • Microsoft StoreBusiness
  • 娱乐Entertainment
  • 印度India
  • 生活方式LifeStyle
  • 政治Politics
  • ScienceAndTechnologyScienceAndTechnology
  • 体育游戏Sports
  • WorldWorld
日本 (ja-jp) Japan (ja-JP)
  • Microsoft StoreBusiness
  • 娱乐Entertainment
  • 日本Japan
  • 生活方式LifeStyle
  • 政治Politics
  • ScienceAndTechnologyScienceAndTechnology
  • 体育游戏Sports
  • WorldWorld
英国 (en) United Kingdom (en-GB)
  • Microsoft StoreBusiness
  • 娱乐Entertainment
  • 健康产业Health
  • 政治Politics
  • ScienceAndTechnologyScienceAndTechnology
  • 体育游戏Sports
  • 英国UK
  • WorldWorld
美国 (zh-cn) United States (en-US)
  • Microsoft StoreBusiness
  • 娱乐Entertainment
    • Entertainment_MovieAndTVEntertainment_MovieAndTV
    • Entertainment_MusicEntertainment_Music
  • 健康产业Health
  • 政治Politics
  • 产品Products
  • ScienceAndTechnologyScienceAndTechnology
    • 技术Technology
    • 科学Science
  • 体育游戏Sports
    • Sports_GolfSports_Golf
    • Sports_MLBSports_MLB
    • Sports_NBASports_NBA
    • Sports_NFLSports_NFL
    • Sports_NHLSports_NHL
    • Sports_SoccerSports_Soccer
    • Sports_TennisSports_Tennis
    • Sports_CFBSports_CFB
    • Sports_CBBSports_CBB
  • USUS
    • US_NortheastUS_Northeast
    • US_SouthUS_South
    • US_MidwestUS_Midwest
    • US_WestUS_West
  • WorldWorld
  • World_AfricaWorld_Africa
  • World_AmericasWorld_Americas
  • World_AsiaWorld_Asia
  • World_EuropeWorld_Europe
  • World_MiddleEastWorld_MiddleEast

错误代码Error codes

下面是请求可能返回的 HTTP 状态代码。The following are the possible HTTP status codes that a request returns.

状态代码Status Code 描述Description
200200 成功。Success.
400400 查询参数之一缺失或无效。One of the query parameters is missing or not valid.
401401 订阅密钥缺失或无效。The subscription key is missing or is not valid.
403403 用户已经过身份验证(例如,用户使用了有效的订阅密钥),但无权访问请求的资源。The user is authenticated (for example, they used a valid subscription key) but they don’t have permission to the requested resource.

如果调用方超出其每月查询配额,必应也可能会返回此状态。Bing may also return this status if the caller exceeded their queries per month quota.
410410 请求使用了 HTTP 而非 HTTPS 协议。The request used HTTP instead of the HTTPS protocol. HTTPS 是唯一支持的协议。HTTPS is the only supported protocol.
429429 调用方超出其每秒查询配额。The caller exceeded their queries per second quota.
500500 意外的服务器错误。Unexpected server error.

如果请求失败,响应会包含一个 ErrorResponse 对象,该对象包含一系列用于描述错误原因的 Error 对象。If the request fails, the response contains an ErrorResponse object, which contains a list of Error objects that describe what caused of error. 如果错误与参数相关,则 parameter 字段会标识导致问题的参数。If the error is related to a parameter, the parameter field identifies the parameter that is the issue. 如果错误与参数值相关,则 value 字段会标识无效的参数值。And if the error is related to a parameter value, the value field identifies the value that is not valid.

{
  "_type": "ErrorResponse", 
  "errors": [
    {
      "code": "InvalidRequest", 
      "subCode": "ParameterMissing", 
      "message": "Required parameter is missing.", 
      "parameter": "q" 
    }
  ]
}

{
  "_type": "ErrorResponse", 
  "errors": [
    {
      "code": "InvalidAuthorization", 
      "subCode": "AuthorizationMissing", 
      "message": "Authorization is required.", 
      "moreDetails": "Subscription key is not recognized."
    }
  ]
}

下面是可能的错误代码和子错误代码值。The following are the possible error code and sub-error code values.

代码Code SubCodeSubCode 描述Description
ServerErrorServerError UnexpectedErrorUnexpectedError
ResourceErrorResourceError
NotImplementedNotImplemented
HTTP 状态代码为 500。HTTP status code is 500.
InvalidRequestInvalidRequest ParameterMissingParameterMissing
ParameterInvalidValueParameterInvalidValue
HttpNotAllowedHttpNotAllowed
已阻止Blocked
只要请求的任何部分无效,必应就会返回 InvalidRequest。Bing returns InvalidRequest whenever any part of the request is not valid. 例如,缺少必需参数或参数值无效。For example, a required parameter is missing or a parameter value is not valid.

如果错误是 ParameterMissing 或 ParameterInvalidValue,HTTP 状态代码为 400。If the error is ParameterMissing or ParameterInvalidValue, the HTTP status code is 400.

如果使用 HTTP 协议而不是 HTTPS 协议,则必应会返回 HttpNotAllowed,且 HTTP 状态代码为 410。If you use the HTTP protocol instead of HTTPS, Bing returns HttpNotAllowed, and the HTTP status code is 410.
RateLimitExceededRateLimitExceeded 无子代码No sub-codes 只要超过每秒查询数 (QPS) 或每月查询数 (QPM) 配额,必应就会返回 RateLimitExceeded。Bing returns RateLimitExceeded whenever you exceed your queries per second (QPS) or queries per month (QPM) quota.

如果超过 QPS,则必应会回 HTTP 状态代码 429;如果超过 QPM,则必应会返回 403。If you exceed QPS, Bing returns HTTP status code 429, and if you exceed QPM, Bing returns 403.
InvalidAuthorizationInvalidAuthorization AuthorizationMissingAuthorizationMissing
AuthorizationRedundancyAuthorizationRedundancy
当必应无法验证调用方身份时,必应会返回 InvalidAuthorization。Bing returns InvalidAuthorization when Bing cannot authenticate the caller. 例如,缺少 Ocp-Apim-Subscription-Key 头或订阅密钥无效。For example, the Ocp-Apim-Subscription-Key header is missing or the subscription key is not valid.

如果指定多个身份验证方法,便会发生冗余。Redundancy occurs if you specify more than one authentication method.

如果错误是 InvalidAuthorization,HTTP 状态代码为 401。If the error is InvalidAuthorization, the HTTP status code is 401.
InsufficientAuthorizationInsufficientAuthorization AuthorizationDisabledAuthorizationDisabled
AuthorizationExpiredAuthorizationExpired
当调用方无权访问资源时,必应会返回 InsufficientAuthorization。Bing returns InsufficientAuthorization when the caller does not have permissions to access the resource. 如果订阅密钥已遭禁用或到期,就会发生此类错误。This can occur if the subscription key has been disabled or has expired.

如果错误是 InsufficientAuthorization,HTTP 状态代码为 403。If the error is InsufficientAuthorization, the HTTP status code is 403.

市场代码Market codes

对于 /news/search endpointhe 下表列出了可用于指定查询参数的市场代码值 mktFor the /news/search endpointhe following table lists the market code values that you may use to specify the mkt query parameter. 必应仅为这些市场返回内容。Bing returns content for only these markets. 列表可能随时变动。The list is subject to change.

有关可使用 cc 查询参数指定的国家/地区代码列表,请参阅国家/地区代码For a list of country codes that you may specify in the cc query parameter, see Country Codes.

国家/地区Country/Region 语言Language 市场代码Market Code
丹麦Denmark 丹麦语Danish da-DKda-DK
奥地利Austria 德语German de-ATde-AT
比利时Belgium 荷兰语Dutch nl-BEnl-BE
瑞士Switzerland 德语German de-CHde-CH
德国Germany 德语German de-DEde-DE
澳大利亚Australia 英语English en-AUen-AU
加拿大Canada 英语English en-CAen-CA
英国United Kingdom 英语English en-GBen-GB
印度尼西亚Indonesia 英语English en-IDen-ID
爱尔兰Ireland 英语English en-IEen-IE
印度India 英语English en-INen-IN
马来西亚Malaysia 英语English en-MYen-MY
新西兰New Zealand 英语English en-NZen-NZ
菲律宾共和国Republic of the Philippines 英语English en-PHen-PH
新加坡Singapore 英语English en-SGen-SG
美国United States 英语English zh-CNen-US
英语English 常规general en-WWen-WW
英语English 常规general en-XAen-XA
南非South Africa 英语English en-ZAen-ZA
阿根廷Argentina 西班牙语Spanish es-ARes-AR
智利Chile 西班牙语Spanish es-CLes-CL
西班牙Spain 西班牙语Spanish es-ESes-ES
墨西哥Mexico 西班牙语Spanish es-MXes-MX
美国United States 西班牙语Spanish es-USes-US
西班牙语Spanish 常规general es-XLes-XL
芬兰Finland 芬兰语Finnish fi-FIfi-FI
法国France 法语French fr-BEfr-BE
加拿大Canada 法语French fr-CAfr-CA
瑞士Switzerland 法语French fr-CHfr-CH
法国France 法语French fr-FRfr-FR
意大利Italy 意大利语Italian it-ITit-IT
香港特别行政区Hong Kong SAR 繁体中文Traditional Chinese zh-HKzh-HK
台湾Taiwan 繁体中文Traditional Chinese zh-TWzh-TW
日本Japan 日语Japanese ja-JPja-JP
韩国Korea 韩语Korean ko-KRko-KR
荷兰Netherlands 荷兰语Dutch nl-NLnl-NL
中华人民共和国People's republic of China 中文Chinese zh-CNzh-CN
波兰Poland 波兰语Polish pl-PLpl-PL
巴西Brazil 葡萄牙语Portuguese pt-BRpt-BR
俄罗斯Russia 俄语Russian ru-RUru-RU
瑞典Sweden 瑞典语Swedish sv-SEsv-SE
土耳其Turkey 土耳其语Turkish tr-TRtr-TR

对于 /news 终结点,下表列出了可用于指定 mkt 查询参数的市场代码值。For the /news endpoint, the following table lists the market code values that you may use to specify the mkt query parameter. 必应仅为这些市场返回内容。Bing returns content for only these markets. 列表可能随时变动。The list is subject to change.

有关可使用 cc 查询参数指定的国家/地区代码列表,请参阅国家/地区代码For a list of country codes that you may specify in the cc query parameter, see Country Codes.

国家/地区Country/Region 语言Language 市场代码Market Code
丹麦Denmark 丹麦语Danish da-DKda-DK
德国Germany 德语German de-DEde-DE
澳大利亚Australia 英语English en-AUen-AU
英国United Kingdom 英语English en-GBen-GB
美国United States 英语English zh-CNen-US
英语English 常规general en-WWen-WW
智利Chile 西班牙语Spanish es-CLes-CL
墨西哥Mexico 西班牙语Spanish es-MXes-MX
美国United States 西班牙语Spanish es-USes-US
芬兰Finland 芬兰语Finnish fi-FIfi-FI
加拿大Canada 法语French fr-CAfr-CA
法国France 法语French fr-FRfr-FR
意大利Italy 意大利语Italian it-ITit-IT
葡萄牙语Portuguese 巴西Brazil pt-BRpt-BR
中华人民共和国People's republic of China 中文Chinese zh-CNzh-CN

对于 /news/trendingtopics endpointhe 下表列出了可用于指定查询参数的市场代码值 mktFor the /news/trendingtopics endpointhe following table lists the market code values that you may use to specify the mkt query parameter. 必应仅为这些市场返回内容。Bing returns content for only these markets. 列表可能随时变动。The list is subject to change.

有关可使用 cc 查询参数指定的国家/地区代码列表,请参阅国家/地区代码For a list of country codes that you may specify in the cc query parameter, see Country Codes.

国家/地区Country/Region 语言Language 市场代码Market Code
德国Germany 德语German de-DEde-DE
澳大利亚Australia 英语English en-AUen-AU
英国United Kingdom 英语English en-GBen-GB
美国United States 英语English zh-CNen-US
加拿大Canada 英语English en-CAen-CA
印度India 英语English en-INen-IN
法国France 法语French fr-FRfr-FR
加拿大Canada 法语French fr-CAfr-CA
葡萄牙语Portuguese 巴西Brazil pt-BRpt-BR
中华人民共和国People's republic of China 中文Chinese zh-CNzh-CN

国家/地区代码Country Codes

下面是可使用 cc 查询参数指定的国家/地区代码。The following are the country codes that you may specify in the cc query parameter. 列表可能随时变动。The list is subject to change.

国家/地区Country/Region 国家/地区代码Country Code
阿根廷Argentina ARAR
澳大利亚Australia AUAU
奥地利Austria ATAT
比利时Belgium BEBE
巴西Brazil BRBR
CanadaCanada CACA
智利Chile CLCL
丹麦Denmark DKDK
芬兰Finland FIFI
法国France FRFR
德国Germany DEDE
香港特别行政区Hong Kong SAR HKHK
印度India ININ
印度尼西亚Indonesia IDID
意大利Italy ITIT
日本Japan JPJP
韩国Korea KRKR
马来西亚Malaysia MYMY
墨西哥Mexico MXMX
荷兰Netherlands NLNL
新西兰New Zealand NZNZ
挪威Norway NO
中华人民共和国People's Republic of China CNCN
波兰Poland PLPL
葡萄牙Portugal PTPT
菲律宾共和国Republic of the Philippines PHPH
俄罗斯Russia RURU
沙特阿拉伯Saudi Arabia SASA
南非South Africa ZAZA
西班牙Spain ESES
瑞典Sweden SESE
瑞士Switzerland CHCH
中国台湾Taiwan TWTW
土耳其Turkey TRTR
United KingdomUnited Kingdom GBGB
United StatesUnited States 美国US

必应支持的语言Bing supported languages

以下是可在setLang查询参数中指定的必应支持的语言。The following are the Bing supported languages that you may specify in the setLang query parameter. 列表可能随时变动。The list is subject to change.

支持的语言Supported Languages 语言代码Language Code
阿拉伯语Arabic arar
巴斯克语Basque eueu
孟加拉语Bengali bnbn
保加利亚语Bulgarian bgbg
加泰罗尼亚语Catalan caca
中文(简体)Chinese (Simplified) zh-hanszh-hans
中文(繁体)Chinese (Traditional) zh-hantzh-hant
克罗地亚语Croatian hrhr
捷克语Czech cscs
丹麦语Danish dada
荷兰语Dutch nlnl
英语English enen
英语-英国English-United Kingdom en-gben-gb
爱沙尼亚语Estonian etet
芬兰语Finnish fifi
法语French frfr
加利西亚语Galician glgl
德语German dede
古吉拉特语Gujarati gugu
希伯来语Hebrew hehe
HindiHindi hihi
匈牙利语Hungarian huhu
冰岛语Icelandic isis
意大利语Italian itit
日语Japanese Jpjp
卡纳达语Kannada knkn
韩语Korean koko
拉脱维亚语Latvian lvlv
立陶宛语Lithuanian ltlt
马来语Malay msms
马拉雅拉姆语Malayalam  mlml
马拉地语Marathi mrmr
挪威语(博克马尔语)Norwegian (Bokmål) nbnb
波兰语Polish plpl
葡萄牙语(巴西)Portuguese (Brazil) pt-brpt-br
葡萄牙语(葡萄牙)Portuguese (Portugal) pt-ptpt-pt
旁遮普语Punjabi papa
罗马尼亚语Romanian roro
俄语Russian ruru
塞尔维亚语(青色)Serbian (Cyrylic) sr
斯洛伐克语Slovak sksk
斯洛文尼亚语Slovenian slsl
西班牙语Spanish eses
瑞典语Swedish svsv
泰米尔语Tamil tata
泰卢固语Telugu tete
泰语Thai thth
土耳其语Turkish trtr
乌克兰语Ukrainian ukuk
越南语Vietnamese vivi