0
public static Document GetDocument(List<long> IdList)
{
          //my code
}

I am passing the parameter from UI as:-

 getMulipleDocument: function (documentId) {
            return $http({
                url: apiUrl + "Info/GetDocument?IdList=" + documentId,});

Bug:- parameter is coming as null in web api method. May I pass the list as parameter in Web api method?

Gorakh Nath
  • 9,140
  • 15
  • 46
  • 68
  • Refer following question and you can derive the ansver. http://stackoverflow.com/questions/9981330/how-to-pass-an-array-of-integers-to-asp-net-web-api – Asiri Dissanayaka Nov 08 '16 at 07:52

1 Answers1

1

Do some few modification in your code. Use FromUri to build your list

public static Document GetDocument([FromUri]List<long> IdList)
{
          //my code
}

Build url like this

var requestUrl = apiUrl + "Info/GetDocument?IdList=" + id1 + "&IdList=" + id2; 

Build requestUrl like query string starting with first id by ?IdList= and then append next ids to url by using &IdList=

In above case you can pass only one id as well bu using only ?IdList= and followed by your id

Suyog
  • 171
  • 7