_method=put&{ "json": "here" } will never work. In a query string you need to assign it to something:
eg. _method=put&json={ "json": "here" } Johan On Sat, Nov 28, 2009 at 9:05 AM, AJ ONeal <alvin.on...@gmail.com> wrote: > I'm making a webservice with JSON going in both directions for all > requests, but seem to have run into a catch 22. > > A) I try the request as "/questions/1.json?_method=put" but since the > _method=put is not in the message body it doesn't count. > > B) I send the params as _method=put&{ "json": "here" } > The request is recognize as a PUT, but the JSON can't be interpreted. > > C) I send the params as { "_method":"put", "json": "here" } > The request isn't recognized as a PUT, but the JSON can be parsed (it works > using "curl -X PUT ...") > > D) I try using GET (with the same approach as A) and it ignores the > parameters and the message body. > > Where should I attack this beast at? > > > AJ ONeal > > Working Examples: > curl 'http://www.whatsayye.com/questions.json?callback=jsonp12345' \ > -X "POST" \ > -H "Content-Type: application/json" \ > -H "Accept: application/json" \ > -d "{ \"question\": { \"question\": \"Created with curl > JSON-ically\", \"url\": \"curljson\" }}" > > curl 'http://www.whatsayye.com/questions/3.json' \ > -X "PUT" \ > -H "Content-Type: application/json" \ > -H "Accept: application/json" \ > -d "{ \"question\": { \"question\": \"Modified with curl > JSON-ically\", \"url\": \"jsonrocks\" }}" > > Failing Examples: > curl 'http://www.whatsayye.com/questions/3.json' \ > * -X "POST" \* > -H "Content-Type: application/json" \ > -H "Accept: application/json" \ > * -d "_method=put" \* > -d "{ \"question\": { \"question\": \"Modified with curl > JSON-ically\", \"url\": \"jsonWAYrocks\" }}" > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-t...@googlegroups.com. > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscr...@googlegroups.com<rubyonrails-talk%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.