Sudheer, I'm not sure why that would be routed as a PUT request if your HTTP Method is POST and you don't have a "_method=PUT" parameter or a "X-HTTP-Method-Override: PUT" HTTP Header. However, if your application is going to be RESTful then your URIs should identify your resources and *not* carry additional data that isn't part of identifying the resource. So, you should just:
POST /webservice/lead not: POST /webservice/lead/apikey/myapikey In other words, apikey/myapikey does not do anything to identify the resource so should not be part of your URI. If your clients must use an API key, then you could have them send it as an HTTP Header. The most RESTful thing (but may or may not the most practical) would probably be to have your clients use HTTP authentication. From what I've seen, this is a topic of much debate (how to implement practical and RESTful authentication). Thanks, Bradley On Mon, Oct 5, 2009 at 11:00 AM, Sudheer Satyanarayana <[email protected]> wrote: > Hi, > > In my application, I have a module - 'webservice' to handle all REST > requests. > > In my front controller I check if the request has a valid API key in the > request URI parameters. If a valid key is not found access is denied. > > Example URI with API key : example.com/webservice/lead/apikey/myapikey > > My problem is, Zend_Rest_Route routes the request to putAction() if it finds > anything after module/controller/ in the URI even though the method is POST. > > Is it possible to route requests to postAction() and pass pass parameters in > the URI? > > Or, is there a better way of managing API key checks for REST requests? > > -- > > With warm regards, > Sudheer. S > Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, > Personal: http://sudheer.net > > > -- Bradley Holt [email protected]
