常见的 REST API 错误代码Common REST API error codes

  • 下表中列出的错误代码可能由任何 Microsoft Defender for Endpoint API 上的操作返回。The error codes listed in the following table may be returned by an operation on any of Microsoft Defender for Endpoint APIs.
  • 除了错误代码之外,每个错误响应还包含一条错误消息,有助于解决问题。In addition to the error code, every error response contains an error message, which can help resolve the problem.
  • 邮件是可更改的免费文本。The message is a free text that can be changed.
  • 在页面底部,可以找到响应示例。At the bottom of the page, you can find response examples.

想要体验适用于终结点的 Defender?Want to experience Defender for Endpoint? 注册免费试用版。Sign up for a free trial.

错误代码Error code HTTP 状态代码HTTP status code 邮件Message
BadRequestBadRequest BadRequest (400) BadRequest (400) 常规错误请求错误消息。General Bad Request error message.
ODataErrorODataError BadRequest (400) BadRequest (400) 指定的特定错误 (OData URI 查询无效) 。Invalid OData URI query (the specific error is specified).
InvalidInputInvalidInput BadRequest (400) BadRequest (400) 无效输入 {无效的输入}。Invalid input {the invalid input}.
InvalidRequestBodyInvalidRequestBody BadRequest (400) BadRequest (400) 无效的请求正文。Invalid request body.
InvalidHashValueInvalidHashValue BadRequest (400) BadRequest (400) 哈希值 {无效的哈希}无效。Hash value {the invalid hash} is invalid.
InvalidDomainNameInvalidDomainName BadRequest (400) BadRequest (400) 域名 {无效的域} 无效。Domain name {the invalid domain} is invalid.
InvalidIpAddressInvalidIpAddress BadRequest (400) BadRequest (400) IP 地址 {无效的 IP} 无效。IP address {the invalid IP} is invalid.
InvalidUrlInvalidUrl BadRequest (400) BadRequest (400) URL {无效的 URL} 无效。URL {the invalid URL} is invalid.
MaximumBatchSizeExceededMaximumBatchSizeExceeded BadRequest (400) BadRequest (400) 已超出最大批次大小。Maximum batch size exceeded. Received: {batch size received}, allowed: {batch size allowed}.Received: {batch size received}, allowed: {batch size allowed}.
MissingRequiredParameterMissingRequiredParameter BadRequest (400) BadRequest (400) 参数 {缺少参数}。Parameter {the missing parameter} is missing.
OsPlatformNotSupportedOsPlatformNotSupported BadRequest (400) BadRequest (400) 此操作不支持 OS 平台 {the client OS Platform}。OS Platform {the client OS Platform} is not supported for this action.
ClientVersionNotSupportedClientVersionNotSupported BadRequest (400) BadRequest (400) {请求的操作} 在客户端版本 {支持的客户端版本} 及以上版本上受支持。{The requested action} is supported on client version {supported client version} and above.
未经授权 (Unauthorized)Unauthorized 未经授权 (401) Unauthorized (401) 未授权 (或过期的授权标头) 。Unauthorized (invalid or expired authorization header).
禁止访问 (Forbidden)Forbidden 禁止 (403) Forbidden (403) 禁止 (有效令牌,但权限不足,无法) 。Forbidden (valid token but insufficient permission for the action).
DisabledFeatureDisabledFeature 禁止 (403) Forbidden (403) 未启用租户功能。Tenant feature is not enabled.
DisallowedOperationDisallowedOperation 禁止 (403) Forbidden (403) {不允许的操作和原因}。{the disallowed operation and the reason}.
NotFoundNotFound 404 (未找到) Not Found (404) "常规未找到"错误消息。General Not Found error message.
ResourceNotFoundResourceNotFound 404 (未找到) Not Found (404) 未找到资源 {请求的资源}。Resource {the requested resource} was not found.
InternalServerErrorInternalServerError 内部服务器错误 (500) Internal Server Error (500) (无错误消息,请重试) (No error message, retry the operation)
TooManyRequestsTooManyRequests 请求数过多 (429) Too Many Requests (429) 响应表示请求数或 CPU 达到配额限制。Response will represent reaching quota limit either by number of requests or by CPU.

正文参数区分大小写Body parameters are case-sensitive

提交的正文参数当前区分大小写。The submitted body parameters are currently case-sensitive.
如果遇到 InvalidRequestBodyMissingRequiredParameter 错误,可能是参数大写或小写字母错误导致的。If you experience an InvalidRequestBody or MissingRequiredParameter errors, it might be caused from a wrong parameter capital or lower-case letter.
查看 API 文档页,并检查提交的参数是否与相关示例匹配。Review the API documentation page and check that the submitted parameters match the relevant example.

相关请求 IDCorrelation request ID

每个错误响应都包含用于跟踪的唯一 ID 参数。Each error response contains a unique ID parameter for tracking.
此参数的属性名称为"target"。The property name of this parameter is "target".
当我们就错误联系我们时,附加此 ID 将有助于找到问题的根本原因。When contacting us about an error, attaching this ID will help find the root cause of the problem.

示例Examples

{
    "error": {
        "code": "ResourceNotFound",
        "message": "Machine 123123123 was not found",
        "target": "43f4cb08-8fac-4b65-9db1-745c2ae65f3a"
    }
}
{
    "error": {
        "code": "InvalidRequestBody",
        "message": "Request body is incorrect",
        "target": "1fa66c0f-18bd-4133-b378-36d76f3a2ba0"
    }
}