我想通过 Api 请求更新嵌入式文档,并且不想 PUT 整个父资源:
Parent {
_id: 123,
...
events: [
...
...
]
}
要更新嵌入文档,RFC 6902 A.16建议:
PATCH /parent-resource/123
[
{ "op": "add", "path": "/events/-", "value": {new event obj}}
]
Success Response: 204 no-content
我非常喜欢这个并且会提供这个。但是为了更容易使用,可以使用以下别名:
POST /parent-resource/123/events
{new event object}
Success Response: 204 no-content
也可以接受?另外,关于 JSON Api 标准有哪些好的资源?