跳到主要内容

6. 错误响应体 (Error Response Body)

某些非应答响应可能返回包含更具描述性信息的实体主体。

该响应的基本结构是一个对象类,包含一个必需的错误代码号(对应于 HTTP 响应代码),后跟一个名为 "title" 的可选字符串和一个名为 "description" 的可选字符串数组。

这是常见响应体的示例。

{
"errorCode": 418,
"title": "Your Beverage Choice is Not Available",
"description":
[
"I know coffee has more ummppphhh.",
"Sorry, dude!"
]
}

图 28

这是包含 rdapConformance 和 notices 数据结构的常见响应体示例:

{
"rdapConformance" :
[
"rdap_level_0"
],
"notices" :
[
{
"title" : "Beverage Policy",
"description" :
[
"Beverages with caffeine for keeping horses awake."
],
"links" :
[
{
"value" : "https://example.net/ip/192.0.2.0/24",
"rel" : "alternate",
"type" : "text/html",
"href" : "https://www.example.com/redaction_policy.html"
}
]
}
],
"lang" : "en",
"errorCode": 418,
"title": "Your beverage choice is not available",
"description":
[
"I know coffee has more ummppphhh.",
"Sorry, dude!"
]
}

图 29