且构网

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

Rest api - 向实体添加标签

更新时间:2022-05-16 10:21:58

简短回答:你会这样做吗

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.