简体   繁体   中英

REST API Endpoint Design: Meta-Data change vs subelement insert

We are discussing how to build a next evolution of our restful API Design. We have the following problem. Think of a resource that will return playlists that have certain elements. Each playlist has a never changing id. At first this looks pretty straight forward.

POST /playlists => create a new playlist, id will be returned
GET /playlists/id => retunrs the playlist contents
POST /playlists/id => insert an element to the playlist
DELETE /playlists/id => delete the whole playlist

Next thing we have is that the playlists all have some meta data. Eg a name. Now how to change that meta data as POST /playlists/id is already taken.

Any best practice advice on this?

我知道这是一个老问题,但是您想将(或PATCH)放入/ playlists / id来更新播放列表本身。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM