This is from the post : http://stackoverflow.com/questions/14610039/how-to-disambiguate-between-two-actions-in-apicontroller
1. __Works (Note: the parameter is NOT an array__
Url=http://localhost:9597/api/values?projectId=2
```
public class ValuesController : ApiController
{
public string GetMany(int projectId)
{
return "GetMany";
}
public string GetAll()
{
return "GetAll";
}
}
```
2. __Does NOT work(receiving ambiguity error):__
Url=http://localhost:9597/api/values?projectId=2,3,4
```
public class ValuesController : ApiController
{
public string GetMany([FromUri]int[] projectId)
{
return "GetMany";
}
public string GetAll()
{
return "GetAll";
}
}
```
There shouldn't be disambiguity in action selection in the 2nd case above as the parameter 'projectId' is correctly specified. I believe the action selection is looking for TypeConverter here as its an Array which is a Complex Type. Since Array is not having a TypeConverter, it seems to not consider the presence of this parameter, making it think to be ambiguous.
1. __Works (Note: the parameter is NOT an array__
Url=http://localhost:9597/api/values?projectId=2
```
public class ValuesController : ApiController
{
public string GetMany(int projectId)
{
return "GetMany";
}
public string GetAll()
{
return "GetAll";
}
}
```
2. __Does NOT work(receiving ambiguity error):__
Url=http://localhost:9597/api/values?projectId=2,3,4
```
public class ValuesController : ApiController
{
public string GetMany([FromUri]int[] projectId)
{
return "GetMany";
}
public string GetAll()
{
return "GetAll";
}
}
```
There shouldn't be disambiguity in action selection in the 2nd case above as the parameter 'projectId' is correctly specified. I believe the action selection is looking for TypeConverter here as its an Array which is a Complex Type. Since Array is not having a TypeConverter, it seems to not consider the presence of this parameter, making it think to be ambiguous.