API 输出中的自身和规范
Self and canonical in API output
我打电话时收到的输出低于 API。
{
"createdOn": "2020-08-01T21:17:15.130Z",
"updatedOn": "2020-08-01T21:17:15.130Z",
"links": [
{
"rel": "self",
"href": "https://idcs-oda-9417f93560b94eb8a2e2a4c9aac9a3ff-t0.data.digitalassistant.oci.oc-test.com/api/v1/bots/B183C87E-7067-4BC9-BD9D-5AFA145532F3/dynamicEntities/975F38A1-E1D1-48B1-AF47-B58E9FBB46A3/pushRequests/6D677CD7-F66F-4C23-8E20-EFC067FAB6F4"
},
{
"rel": "canonical",
"href": "https://idcs-oda-9417f93560b94eb8a2e2a4c9aac9a3ff-t0.data.digitalassistant.oci.oc-test.com/api/v1/bots/B183C87E-7067-4BC9-BD9D-5AFA145532F3/dynamicEntities/975F38A1-E1D1-48B1-AF47-B58E9FBB46A3/pushRequests/6D677CD7-F66F-4C23-8E20-EFC067FAB6F4"
}
我知道 rel, href
在那里是因为 HATEOAS
。我也知道 self
在这里是什么意思。
我很好奇canonical
是什么?代表什么。
这里是所有官方 link 关系类型的列表,特别是那些已被记录为标准的关系类型:
https://www.iana.org/assignments/link-relations/link-relations.xhtml
在那里你会发现 canonical
定义在 RFC6596.
该文档的摘要如下:
In regard to the link relation type, "canonical" can be described
informally as the author's preferred version of a resource. More
formally, the canonical link relation specifies the preferred IRI
from a set of resources that return the context IRI's content in
duplicated form. Once specified, applications such as search engines
can focus processing on the canonical, and references to the context
(referring) IRI can be updated to reference the target (canonical)
IRI.
我打电话时收到的输出低于 API。
{
"createdOn": "2020-08-01T21:17:15.130Z",
"updatedOn": "2020-08-01T21:17:15.130Z",
"links": [
{
"rel": "self",
"href": "https://idcs-oda-9417f93560b94eb8a2e2a4c9aac9a3ff-t0.data.digitalassistant.oci.oc-test.com/api/v1/bots/B183C87E-7067-4BC9-BD9D-5AFA145532F3/dynamicEntities/975F38A1-E1D1-48B1-AF47-B58E9FBB46A3/pushRequests/6D677CD7-F66F-4C23-8E20-EFC067FAB6F4"
},
{
"rel": "canonical",
"href": "https://idcs-oda-9417f93560b94eb8a2e2a4c9aac9a3ff-t0.data.digitalassistant.oci.oc-test.com/api/v1/bots/B183C87E-7067-4BC9-BD9D-5AFA145532F3/dynamicEntities/975F38A1-E1D1-48B1-AF47-B58E9FBB46A3/pushRequests/6D677CD7-F66F-4C23-8E20-EFC067FAB6F4"
}
我知道 rel, href
在那里是因为 HATEOAS
。我也知道 self
在这里是什么意思。
我很好奇canonical
是什么?代表什么。
这里是所有官方 link 关系类型的列表,特别是那些已被记录为标准的关系类型:
https://www.iana.org/assignments/link-relations/link-relations.xhtml
在那里你会发现 canonical
定义在 RFC6596.
该文档的摘要如下:
In regard to the link relation type, "canonical" can be described informally as the author's preferred version of a resource. More formally, the canonical link relation specifies the preferred IRI from a set of resources that return the context IRI's content in duplicated form. Once specified, applications such as search engines can focus processing on the canonical, and references to the context (referring) IRI can be updated to reference the target (canonical) IRI.