Create single and multiple resources using restful HTTP

前端 未结 5 985
时光取名叫无心
时光取名叫无心 2021-02-07 00:21

In my API server I have this route defined:

POST /categories

To create one category you do:

POST /categories {\"name\": \"Books         


        
5条回答
  •  甜味超标
    2021-02-07 00:41

    Actually this is still a hot topic till today, But simplify things I almost of the time say there is always a batter suited scenario for each practice. Eg: 1. If you are receiving the likes from a post you don't need the bulk as in case there is only one like per comment. 2. If you are receiving favorites comment the bulk can fit well by considering someone reviewing the comment he reads and check box all of his favorites and send it once.

    Again this is based on my experience working with Restful API, and but currently for the sake of multi tasking and others things, me and my colleague we found our selves doing the bulk all the time in most MIS(Management Information System) we do. This is because modern days web app and mobile app that can do a lot of work and send the final results to the back-end, this way the back-end has little job to do as long as the data received don't violate the business logic.

提交回复
热议问题