0

I have two controller actions defined in my AgenciesController as follows:

 public IEnumerable<AgencyDTO> GetAll()
        {

        }

        public AgencyDTO GetForLocation(double lat, double lon)
        {

        }

When I submit the following HTTP GET request

  http://localhost:13057/api/agencies?lat=45.4214&lon=-75.6919

the second method that accepts two double input paramters is never invoked. Instead GetAll is always invoked. This is using the default WebApiConfig which from my understanding should be sufficient. I tried using strings for parameters lat and lon and it did not make a difference.

What am I missing?

TIA.

Klaus Nji
  • 18,107
  • 29
  • 105
  • 185

1 Answers1

0

This was an issue with how the HTTP GET request was being submitted. I was using cURL to submit the request and it was stripping out the query parameters after the URL. I needed to soround the entire URL with double quotes as follows:

curl -X GET "http://localhost:13057/api/agencies?lat=45.4214&lon=-75.6919"

In hindsight, I should have indicated ths request was being submitted or tried submitting via the browser before posting the question.

Klaus Nji
  • 18,107
  • 29
  • 105
  • 185