且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

REST API-向实体添加标签

更新时间:2022-05-03 07:10:02

简短的答案:你会这样吗

Short answer: is you would do it like this

假设您的实体是创建实体的内容,您将:

Assuming your entity is the content in your to create an entity you would:

POST /entity

这将创建一个实体并返回一个实体ID,例如29292

This will create an entity and return an entity id, for example 29292

如果您需要在实体上添加标签,则可以按如下所示进入层次结构:

if you need to add tags on an entity you would go down the hierarchy like this:

POST /entity/29292/tags

要删除标签,只需

DELETE /entity/29292/tags

长答案:您想研究本指南有关创建具有更多细节和***功能的静态api的信息习惯.

Long answer: you want to study this guideline on creating restful apis that has a lot more details and best practices.