首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何从HATEOAS中的集合中删除链接的资源?

如何从HATEOAS中的集合中删除链接的资源?
EN

Stack Overflow用户
提问于 2016-03-18 03:08:19
回答 1查看 649关注 0票数 2

如何使用HATEOAS从对象集合中删除资源?

PUT将设置集合。补丁将允许部分更新/添加。

但是我怎么做部分更新/删除呢?

我真的需要发布整个uri-list减去1才能删除单个项目吗?

以此对象为例:

代码语言:javascript
复制
{
  "name": "Bob Test",
  "description": "this is the descript",
  "_links": {
    "self": {
      "href": "http://localhost/example/1"
    },
    "example": {
      "href": "http://localhost/example/1"
    },
    "citations": {
      "href": "http://localhost/example/1/citations"
    },
   }
}

该对象有许多引用(集合):

代码语言:javascript
复制
{
  "_embedded": {
    "citations": [
      {
        "content": "asdfasdf",
        "anchor": null,
        "_links": {
          "self": {
            "href": "http://localhost/citations/1"
          },
          "citation": {
            "href": "http://localhost/citations/1"
          },
          "bioMarker": {
            "href": "http://localhost/citations/1/example"
          }
        }
      },
      {
        "content": "c2",
        "anchor": "prf",
        "_links": {
          "self": {
            "href": "http://localhost/citations/2"
          },
          "citation": {
            "href": "http://localhost/citations/2"
          },
          "bioMarker": {
            "href": "http://localhost/citations/2/example"
          }
        }
      }
    ]
  },
  "_links": {
    "self": {
      "href": "http://localhost/example/1/citations"
    }
  }
}

现在假设我想要删除http://localhost/citations/2,如何从http://localhost/example/1/citations集合中删除此特定项?

EN

回答 1

Stack Overflow用户

发布于 2019-01-07 13:55:06

从响应中获取内容类型,并在请求头部"Accept“中发送。通常是"application/xxxxx+json“

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/36069584

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档