I had a problem passing the array to my service, it only recognizes the first value in the array:
Here is my request object:
[Route("/dashboard", "GET")]
public class DashboardRequest : IReturn<Dashboard>
{
public int[] EquipmentIds { get; set; }
}
Here is the request that is made:
http://localhost:9090/json/reply/DashboardRequest?EquipmentIds=1&EquipmentIds=2
But when I observe an array in my service, it contains only one value, which 1.
public object Get(DashboardRequest request)
{
}
One of the decisions I made is the following, which seems a bit hacky? I thought it was pointed out in my request object that I get a strongly typed request object?
var equipmentIds = Request
.QueryString["EquipmentIds"]
.Split(',')
.Select(int.Parse)
.ToList();
source
share