简体   繁体   English

如何使用角度ngresource为多个项目形成DELETE REST URL

[英]how to form a DELETE REST URL for multiple items with angular ngresource

suppose my curl url for DELETE request looks like 假设我的DELETE请求的curl URL看起来像

website.com/res/resource_name?myid=(1,2,3,4)

How should I create an angular resource wherein I simply pass an array of IDs and get this rest URL? 我应该如何创建一个角度资源,其中我只需传递一个ID数组并获取此剩余URL?

note: 注意:

I am using restSQL, this is an example for deleting a single item http://restsql.org/doc/ref/ResDeleteQuery.html 我正在使用restSQL,这是删除单个项目的示例http://restsql.org/doc/ref/ResDeleteQuery.html

I can delete a single item, but I want to delete multiple at the same time. 我可以删除一个项目,但是我想同时删除多个项目。 The above rest URL works for me via curl request. 上面的rest URL通过curl请求对我有用。

This is not how REST works. REST并非如此。 One of the key principles of REST is that every resource has a unique URL. REST的主要原则之一是每个资源都有唯一的URL。 It implies you must perform a delete request for each resource. 这意味着您必须对每个资源执行删除请求。 It's a drawback in this case, as it multiplies requests. 在这种情况下,这是一个缺点,因为它会增加请求。 But it allows caching response. 但是它允许缓存响应。 And you read data much more frequently than you delete them ;) 而且您读取数据的频率要比删除数据的频率高得多;)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM