My webAPI solution currently works if I send a single id to the delete endpoint:
DELETE /api/object/1
With:
[HttpDelete]
public HttpResponseMessage DeleteFolder(int id)
{
// Do stuff
}
In my client application I have a UI that allows for multiple deletes - right now it's just calling this endpoint in a loop for each one of the ids selected, which isn't super performant. I'd like to be able to send an array of Ids to the Delete method in this case... how can this be achieved?
[HttpDelete]
public HttpResponseMessage DeleteFolder(int[] ids)
{
// Do stuff
}
and then you could send the following HTTP request:
DELETE /api/somecontroller HTTP/1.1
Accept: application/json
Content-Length: 7
Content-Type: application/json
Host: localhost:52996
Connection: close
[1,2,3]
[HttpDelete]
public HttpResponseMessage Folder([FromUri] int[] ids)
{
//logic
}
api call
DELETE /api/Folder?ids=1&ids=2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With