Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.