I build an API using .Net Framework , I have a controller
[RoutePrefix("api/student")]
public StudentController : ApiController
{
private readonly IService service;
}
public StudentController(IService service)
{
this.service = service
}
[HttpGet, Route("getStudents/{Ids:int}")]
public async Task<IHttpActionResult> GetStudents([FromUri]GetStudentsRequest request)
{
//bla bla bla
}
and the class GetStudentsRequest is
public class GetStudentsRequest
{
public int[] Ids { get; set; }
}
I want to pass many ids in a single request, but the problem is how to pass for example 3 ids via postman??
Or I must change the attribute?
I want only from uri not from body!
I try this Pass an array of integers to ASP.NET Web API? the highest ranking answer localhost:XXXXX/api/student/getStudents?Ids=1&Ids=2 but did not work. The different is that I have an object which have property the array.