获取应用的错误报告数据Get error reporting data for your app

在 Microsoft Store 分析 API 中使用此方法,可获取给定日期范围和其他可选筛选器的应用聚合错误报告数据(格式为 JSON)。Use this method in the Microsoft Store analytics API to get aggregate error reporting data for your app in JSON format for a given date range and other optional filters. 此方法只能检索过去30天内发生的错误。This method can only retrieve errors that occurred in the last 30 days. 此信息也可在合作伙伴中心的运行状况报告的 "失败" 部分中找到。This information is also available in the Failures section of the Health report in Partner Center.

你可以使用获取错误详细信息获取堆栈跟踪下载 CAB 文件获取其他错误信息。You can retrieve additional error information by using the get error details, get stack trace, and download CAB file methods.

必备条件Prerequisites

若要使用此方法,首先需要执行以下操作:To use this method, you need to first do the following:

  • 完成 Microsoft Store 分析 API 的所有先决条件(如果尚未这样做)。If you have not done so already, complete all the prerequisites for the Microsoft Store analytics API.
  • 获取 Azure AD 访问令牌,以供在此方法的请求标头中使用。Obtain an Azure AD access token to use in the request header for this method. 获取访问令牌后,在它到期前,你有 60 分钟的使用时间。After you obtain an access token, you have 60 minutes to use it before it expires. 该令牌到期后,可以获取新的令牌。After the token expires, you can obtain a new one.

请求Request

请求语法Request syntax

方法Method 请求 URIRequest URI
GETGET https://manage.devcenter.microsoft.com/v1.0/my/analytics/failurehits

请求头Request header

标头Header 类型Type 描述Description
授权Authorization 字符串string 必需。Required. Azure AD 访问令牌的格式为 Bearer <token> 。The Azure AD access token in the form Bearer <token>.

请求参数Request parameters

参数Parameter 类型Type 说明Description 必需Required
applicationIdapplicationId 字符串string 要检索错误报告数据的应用的 Store ID。The Store ID of the app for which you want to retrieve error reporting data. 可以在合作伙伴中心的 "应用标识" 页上获取存储 ID。The Store ID is available on the App identity page in Partner Center. Store ID 示例:9WZDNCRFJ3Q8。An example Store ID is 9WZDNCRFJ3Q8. Yes
startDatestartDate datedate 要检索的错误报告数据日期范围中的开始日期。The start date in the date range of error reporting data to retrieve. 默认值为当前日期。The default is the current date. 如果 aggregationLeveldayweekmonth,此参数应采用 mm/dd/yyyy 格式指定日期。If aggregationLevel is day, week, or month, this parameter should specify a date in the format mm/dd/yyyy. 如果 aggregationLevelhour,此参数可以采用 mm/dd/yyyy 格式指定日期或者采用 yyyy-mm-dd hh:mm:ss 格式指定日期和时间。If aggregationLevel is hour, this parameter can specify a date in the format mm/dd/yyyy or a date and time in the format yyyy-mm-dd hh:mm:ss.

注意:    此方法只能检索过去30天内发生的错误。Note:  This method can only retrieve errors that occurred in the last 30 days.

No
endDateendDate 日期date 要检索的错误报告数据日期范围中的结束日期。The end date in the date range of error reporting data to retrieve. 默认值为当前日期。The default is the current date. 如果 aggregationLeveldayweekmonth,此参数应采用 mm/dd/yyyy 格式指定日期。If aggregationLevel is day, week, or month, this parameter should specify a date in the format mm/dd/yyyy. 如果 aggregationLevelhour,此参数可以采用 mm/dd/yyyy 格式指定日期或者采用 yyyy-mm-dd hh:mm:ss 格式指定日期和时间。If aggregationLevel is hour, this parameter can specify a date in the format mm/dd/yyyy or a date and time in the format yyyy-mm-dd hh:mm:ss. No
toptop intint 要在请求中返回的数据行数。The number of rows of data to return in the request. 如果未指定,最大值和默认值为 10000。The maximum value and the default value if not specified is 10000. 当查询中存在多行数据时,响应正文中包含的下一个链接可用于请求下一页数据。If there are more rows in the query, the response body includes a next link that you can use to request the next page of data. No
skipskip intint 要在查询中跳过的行数。The number of rows to skip in the query. 使用此参数可以浏览较大的数据集。Use this parameter to page through large data sets. 例如,top=10000 和 skip=0,将检索前 10000 行数据;top=10000 和 skip=10000,将检索之后的 10000 行数据,依此类推。For example, top=10000 and skip=0 retrieves the first 10000 rows of data, top=10000 and skip=10000 retrieves the next 10000 rows of data, and so on. No
filterfilter stringstring 在响应中筛选行的一条或多条语句。One or more statements that filter the rows in the response. 每条语句包含的响应正文中的字段名称和值使用 eqne 运算符进行关联,并且语句可以使用 andor 进行组合。Each statement contains a field name from the response body and value that are associated with the eq or ne operators, and statements can be combined using and or or. filter 参数中的字符串值必须使用单引号引起来。String values must be surrounded by single quotes in the filter parameter. 可以指定响应正文中的以下字段:You can specify the following fields from the response body:

  • applicationNameapplicationName
  • failureNamefailureName
  • failureHashfailureHash
  • 代号symbol
  • osVersionosVersion
  • osReleaseosRelease
  • eventTypeeventType
  • marketmarket
  • deviceTypedeviceType
  • packageNamepackageName
  • packageVersionpackageVersion
  • datedate
No
aggregationLevelaggregationLevel stringstring 指定用于检索聚合数据的时间范围。Specifies the time range for which to retrieve aggregate data. 可以是以下字符串之一:hourdayweekmonthCan be one of the following strings: hour, day, week, or month. 如果未指定,默认值为 dayIf unspecified, the default is day. 如果指定 weekmonth,则 failureNamefailureHash 值限制为 1000 个存储桶。If you specify week or month, the failureName and failureHash values are limited to 1000 buckets.

注意:    如果指定小时,则只能从以前的72小时内检索错误数据。Note:  If you specify hour, you can retrieve error data only from the previous 72 hours. 若要检索早于 72 小时的错误数据,请指定 day 或其他聚合级别之一。To retrieve error data older than 72 hours, specify day or one of the other aggregation levels.

No
orderbyorderby stringstring 对结果数据值进行排序的语句。A statement that orders the result data values. 语法为 orderby=field [order],field [order],...,其中 field 参数可以是以下字符串之一:The syntax is orderby=field [order],field [order],.... The field parameter can be one of the following strings:
  • applicationNameapplicationName
  • failureNamefailureName
  • failureHashfailureHash
  • 代号symbol
  • osVersionosVersion
  • osReleaseosRelease
  • eventTypeeventType
  • marketmarket
  • deviceTypedeviceType
  • packageNamepackageName
  • packageVersionpackageVersion
  • datedate

order 参数是可选的,可以是 ascdesc,用于指定每个字段的升序或降序排列。The order parameter is optional, and can be asc or desc to specify ascending or descending order for each field. 默认值为ascThe default is asc.

下面是一个 orderby 字符串的示例:orderby=date,marketHere is an example orderby string: orderby=date,market

No
groupbygroupby stringstring 仅将数据聚合应用于指定字段的语句。A statement that applies data aggregation only to the specified fields. 可以指定的字段如下所示:You can specify the following fields:
  • failureNamefailureName
  • failureHashfailureHash
  • 代号symbol
  • osVersionosVersion
  • eventTypeeventType
  • marketmarket
  • deviceTypedeviceType
  • packageNamepackageName
  • packageVersionpackageVersion

返回的数据行会包含 groupby 参数中指定的字段,以及以下字段:The returned data rows will contain the fields specified in the groupby parameter as well as the following:

  • datedate
  • applicationIdapplicationId
  • applicationNameapplicationName
  • deviceCountdeviceCount
  • eventCounteventCount

groupby 参数可以与 aggregationLevel 参数结合使用。The groupby parameter can be used with the aggregationLevel parameter. 例如: * & Groupby = failureName,marketplace & aggregationLevel = week*For example: &groupby=failureName,market&aggregationLevel=week

No

请求示例Request example

以下示例演示用于获取错误报告数据的多个请求。The following examples demonstrate several requests for getting error reporting data. applicationId 值替换为你的应用的 Store ID。Replace the applicationId value with the Store ID for your app.

GET https://manage.devcenter.microsoft.com/v1.0/my/analytics/failurehits?applicationId=9NBLGGGZ5QDR&startDate=1/1/2015&endDate=2/1/2015&top=10&skip=0 HTTP/1.1
Authorization: Bearer <your access token>

GET https://manage.devcenter.microsoft.com/v1.0/my/analytics/failurehits?applicationId=9NBLGGGZ5QDR&startDate=8/1/2015&endDate=8/31/2015&skip=0&filter=market eq 'US' and deviceType eq 'phone' HTTP/1.1
Authorization: Bearer <your access token>

响应Response

响应正文Response body

Value 类型Type 说明Description
ValueValue arrayarray 包含聚合错误报告数据的对象数组。An array of objects that contain aggregate error reporting data. 有关每个对象中的数据的详细信息,请参阅以下错误值部分。For more information about the data in each object, see the error values section below.
@nextLink stringstring 如果存在其他数据页,则此字符串包含一个你可用来请求下一页数据的 URI。If there are additional pages of data, this string contains a URI that you can use to request the next page of data. 例如,当请求的 top 参数设置为 10000,但查询的错误超过 10000 行时,就会返回此值。For example, this value is returned if the top parameter of the request is set to 10000 but there are more than 10000 rows of errors for the query.
TotalCountTotalCount integerinteger 查询的数据结果中的行总数。The total number of rows in the data result for the query.

错误值Error values

Value 数组中的元素包含以下值。Elements in the Value array contain the following values.

Value 类型Type 描述Description
datedate stringstring 错误数据的日期范围内的第一个日期,格式为 yyyy-mm-ddThe first date in the date range for the error data, in the format yyyy-mm-dd. 如果请求指定某一天,此值就是该日期。If the request specifies a single day, this value is that date. 如果请求指定更长的日期范围,此值则是该日期范围的第一个日期。If the request specifies a longer date range, this value is the first date in that date range. 如果请求指定的 aggregationLevel 值为 hour,则此值还包括时间值,其格式为 hh:mm:ssFor requests that specify an aggregationLevel value of hour, this value also includes a time value in the format hh:mm:ss.
applicationIdapplicationId stringstring 要检索错误数据的应用的 Store ID。The Store ID of the app for which you want to retrieve error data.
applicationNameapplicationName stringstring 应用的显示名称。The display name of the app.
failureNamefailureName stringstring 故障的名称,它由四个部分组成:一个或多个问题类、异常/错误检查代码、发生故障的映像的名称和相关的函数名称。The name of the failure, which is made up of four parts: one or more problem classes, an exception/bug check code, the name of the image where the failure occurred, and the associated function name.
failureHashfailureHash 字符串string 错误的唯一标识符。The unique identifier for the error.
符号symbol stringstring 分配给该错误的符号。The symbol assigned to this error.
osVersionosVersion stringstring 用于指定发生了错误的操作系统版本的以下字符串之一:One of the following strings that specifies the OS version on which the error occurred:
  • Windows Phone 7.5Windows Phone 7.5
  • Windows Phone 8Windows Phone 8
  • Windows Phone 8.1Windows Phone 8.1
  • Windows Phone 10Windows Phone 10
  • Windows 8Windows 8
  • Windows 8.1Windows 8.1
  • Windows 10Windows 10
  • UnknownUnknown
osReleaseosRelease stringstring 用于指定发生了错误的操作系统版本或外部测试 Ring(作为操作系统版本内的亚组)的以下字符串之一。One of the following strings that specifies the OS release or flighting ring (as a subpopulation within OS version) on which the error occurred.

对于 Windows 10:For Windows 10:

  • 版本1507Version 1507
  • 版本 1511Version 1511
  • 版本1607Version 1607
  • 版本1703Version 1703
  • 版本1709Version 1709
  • 版本1803Version 1803
  • Release PreviewRelease Preview
  • 预览体验成员 - 快Insider Fast
  • 预览体验成员 - 慢Insider Slow

对于 Windows Server 1709:For Windows Server 1709:

  • RTMRTM

对于 Windows Server 2016:For Windows Server 2016:

  • 版本1607Version 1607

对于 Windows 8.1:For Windows 8.1:

  • 更新 1Update 1

对于 Windows 7:For Windows 7:

  • Service Pack 1Service Pack 1

如果操作系统版本或外部测试 Ring 未知,则此字段的值为 UnknownIf the OS release or flighting ring is unknown, this field has the value Unknown.

eventTypeeventType 字符串string 以下字符串之一:One of the following strings:
  • 致使crash
  • hanghang
  • 记忆memory
  • jsejse
marketmarket stringstring 设备市场的 ISO 3166 国家/地区代码。The ISO 3166 country code of the device market.
deviceTypedeviceType stringstring 用于指示发生了错误的设备类型的以下字符串之一:One of the following strings that indicates the type of device on which the error occurred:
  • PCPC
  • 移动Phone
  • 控制台-Xbox OneConsole-Xbox One
  • 控制台-Xbox 系列 XConsole-Xbox Series X
  • IoTIoT
  • HolographicHolographic
  • UnknownUnknown
packageNamepackageName stringstring 与此错误相关联的应用包的唯一名称。The unique name of the app package that is associated with this error.
packageVersionpackageVersion stringstring 与此错误相关联的应用包的版本。The version of the app package that is associated with this error.
deviceCountdeviceCount 数字number 对应于指定聚合级别的该错误的唯一设备数目。The number of unique devices that correspond to this error for the specified aggregation level.
eventCounteventCount 数字number 归因于指定聚合级别的该错误的事件数目。The number of events that are attributed to this error for the specified aggregation level.

响应示例Response example

以下示例举例说明此请求的 JSON 响应正文。The following example demonstrates an example JSON response body for this request.

{
  "Value": [
    {
      "date": "2017-03-09",
      "applicationId": "9NBLGGGZ5QDR",
      "applicationName": "Contoso Demo",
      "failureName": "APPLICATION_FAULT_8013150a_StoreWrapper.ni.DLL!70475e55",
      "failureHash": "5a6b2170-1661-ed47-24d7-230fed0077af",
      "symbol": "storewrapper_ni!70475e55",
      "osVersion": "Windows 10",
      "osRelease": "Version 1507",
      "eventType": "crash",
      "market": "US",
      "deviceType": "PC",
      "packageName": "",
      "packageVersion": "0.0.0.0",
      "deviceCount": 0.0,
      "eventCount": 1.0
    }
  ],
  "@nextLink": "failurehits?applicationId=9NBLGGGZ5QDR&aggregationLevel=week&startDate=2017/03/01&endDate=2016/02/01&top=1&skip=1",
  "TotalCount": 21
}