将DELETE请求发送到集合端点

时间:2017-02-16 16:52:39

标签: rest

您认为以下API有多不稳定:

/posts:  
  /{post-id}: 
    /likes:
      description: Collection of 'likes' that can be allocated to a post
      get:
        description: Get likes for a post
        is: [traits.pageable]
      post:
        description: Add a like to a post
      delete:
        description: Unlike a post (with queryParameter identifying the user) 

请注意,delete请求将发送到集合(而不是单个实体) 我没有看到以下形式提供单一资源的重点:

/posts: 
  /{post-id}: 
    /likes/{like-id} => DELETE

使用像Mongodb这样的数据库,喜欢也可以 - 根本没有id。

0 个答案:

没有答案