开发者

Restful Mass-Action

I'm currently working on a restful-API for an existing product, and come to a quite tricky problem: The Existing application supports several mass actions, i.e. mass-delete or grids for mass-setting certain properties of records. Using the usual restful-pattern, i`d have to send a api-call for each record, (DELETE or UPDATE), but with large amounts of records this will obviously be quite slow. so i was wondering, if someone already found a good solution for this, especially regarding usage with existing restful-technology (开发者_如何学Pythonlike Extjs restful store). So far if come up with these possible solutions:

  • Making my restful controllers use a reserved parameter ("_requests" or something) as an array and mapping each item to a single call internally.
  • using a seperate controller for each mass-action i want. This seems cleaner, but way more work, both on the backend and the application using the API.

Any thoughts?


RESTful things act on Resources, so perhaps have the URI refer to a collection (even describing the collection if needed), and post a delete to that URI. In RESTful terms, you're passing the collection resource in a deleted state to its URI. So:

Delete -> stub/collections/ids=141,159,235,900

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜