How to move a REST resource?

后端 未结 3 2079
无人共我
无人共我 2021-02-05 23:42

I\'m trying to move a resource from /buckets/1 to /buckets/2 such that:

Initial state

  • /buckets/1 = foo
  • /buckets/2 = HT
3条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-06 00:22

    1. Create original resource:

      PUT /bucket/1

    2. Call server procedure that responsible for moving resources:

      POST /bucket/1/move-to/2

    3. Original resource path now should return Moved status code:

      GET /bucket/1 HTTP 301

    4. Resource now should be available on new path:

      GET /bucket/2 HTTP 200

提交回复
热议问题