0

I'm new to Web API and I'm trying to pass an array of integers back from my Get method. Surprisingly, it was working okay when I did it on my work PC but when I re-wrote it on my home PC, it is coming as a zero length array. I have checked this question and all looks good, but there's something I am missing.

[HttpGet]
[Route("test")]
public ActionResult<string> Test([FromQuery] int[] productIds)
{
    //code here
}

From Url:

https://localhost:44389/api/myController/test?productIds=1&productIds=2&productIds=3&productIds=4&productIds=5

It catches the route, but when I check this in debugger, productIds.Length is zero. Please indicate what's wrong with my url/code.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
sam
  • 391
  • 1
  • 5
  • 19

0 Answers0