RESTful URL for “Activate”

后端 未结 3 1290
谎友^
谎友^ 2021-02-06 02:34

I have a resource (project) which can be activated and deactivated.
What\'s the most RESTful URL endpoint for this purpose?

Right now I\'m thinking abou

3条回答
  •  我在风中等你
    2021-02-06 03:20

    Your can send your requests just to projects/{id} and use PATCH (as you're updating existing object) verb, e.g.

    PATCH /projects/123
    
    [
        { "op": "activate|deactivate", ... }
    ]
    

    Read more: REST API - PUT vs PATCH with real life examples

提交回复
热议问题