ajax - Passing array of integers to WebAPI method in URI params? -


i have following:

    [httpdelete]     public httpresponsemessage deletefolder(int[] ids)     { 

and i'm trying use this:

delete http://localhost:24144/api/folder/1483; delete http://localhost:24144/api/folder/[1483] 

but these coming null within delete method - how send data without putting in body (since delete request)?

my routing has this:

            routes.maphttproute(            name: "folder",            routetemplate: "api/folder/{id}",            defaults: new { controller = "folder", id = routeparameter.optional }             ); 

nevermind, found this:

http://blog.codelab.co.nz/2012/10/16/passing-arrays-into-asp-net-web-api-as-parameters/

couldn't find answer on though i'll leave here.

exerpt above linked page:

[httpget()] public httpresponsemessage findbymembers([fromuri]int32[] ids = null) {    //do stuff     return request.createresponsemessage(httpstatuscode.ok); } 

the url http://mywebsite/api/mycontroller/findbymembers/?ids=1&ids=2&ids=3.


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -