HAL 规范 - self link 是否应该包含查询参数?
HAL Specification - Should self link contain query parameter?
在 HAL specification 之后 self link 应该包含查询参数还是 link 到第一页?
谢谢
举个例子:
要求:
my-service/movies/123/subtitles?page=3
实际 JSON 响应:
{
"count": 20,
"pagingSize": 5,
"_links": {
"next": {
"href": "/my-service/movies/123/subtitles?page=4"
},
"previous": {
"href": "/my-service/movies/123/subtitles?page=2"
},
"self": {
"href": "/my-service/movies/123/subtitles"
},
"movie": {
"href": "/my-service/movies/123"
}
},
"_embedded": {
"subtitles": [
{
"id": "111",
"_links": {
"self": {
"href": "/my-service/subtitles/111"
}
}
},
...
{
"id": "222",
"_links": {
"self": {
"href": "/my-service/subtitles/222"
}
}
}
]
}
}
Hypertext Application Language (HAL) proposed draft specification enforces the "href" in conformity with the "Target IRI" defined in Web Linking specification (RFC 5988).
Applications that don't wish to register a relation type can use an
extension relation type, which is a URI [RFC3986] that uniquely
identifies the relation type.
所以我会说 self 值必须是唯一的,因此 包括任何(未指定的可选)查询参数。
在 HAL specification 之后 self link 应该包含查询参数还是 link 到第一页? 谢谢
举个例子:
要求:
my-service/movies/123/subtitles?page=3
实际 JSON 响应:
{
"count": 20,
"pagingSize": 5,
"_links": {
"next": {
"href": "/my-service/movies/123/subtitles?page=4"
},
"previous": {
"href": "/my-service/movies/123/subtitles?page=2"
},
"self": {
"href": "/my-service/movies/123/subtitles"
},
"movie": {
"href": "/my-service/movies/123"
}
},
"_embedded": {
"subtitles": [
{
"id": "111",
"_links": {
"self": {
"href": "/my-service/subtitles/111"
}
}
},
...
{
"id": "222",
"_links": {
"self": {
"href": "/my-service/subtitles/222"
}
}
}
]
}
}
Hypertext Application Language (HAL) proposed draft specification enforces the "href" in conformity with the "Target IRI" defined in Web Linking specification (RFC 5988).
Applications that don't wish to register a relation type can use an extension relation type, which is a URI [RFC3986] that uniquely identifies the relation type.
所以我会说 self 值必须是唯一的,因此 包括任何(未指定的可选)查询参数。