REST URIs and operations on an object that can be commented on, tagged, rated, etc

后端 未结 7 2025
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-06 08:22

I\'m doing research into a web API for my company, and it\'s starting to look like we might implement a RESTful one. I\'ve read a couple of books about this now (O\'Reilly\'s \"

7条回答
  •  逝去的感伤
    2021-02-06 08:33

    Well, the way I see it some of the information you return now as objects could simply be added to the metadata of its parent object.

    For instance, rating could be part of the response of /movies/5

    
       ..
       ..
       4
       
          creative
          ...
    

    Removing a tag simply means posting the above response without that tag.

    Also queries should go in URL variables, I believe: /movies/?startsWith=Forrest%20G&orderBy=DateAdded

提交回复
热议问题