I'm attempting to add a user to a list. To do this, I need to POST
to /:user/:list_id/members (:user is the owner of the group) with an
id parameter that refers to a user to add to the list. Here's what my
call looks like:
client.alexanderkahn._('funny-list').members! :id => 2352334
This returns a 404, because the URL I'm posting to is:
http://twitter.com/alexanderkahn/funny-list/members/23523333.json
I believe this URL is getting used because the call_with_format method
appends my ID parameter to the URL to be requested rather than passing
it along as a POST parameter. Here's that method:
def call_with_format(format)
id = request.params.delete(:id)
request << "/#{id}" if id
request << ".#{format}"
res = send_request
process_response(format,res)
ensure
clear
end
(http://github.com/hayesdavis/grackle/blob/master/lib/grackle/
client.rb#L215-223)
Am I correct in guessing that this appending is causing this error? I
guess that some Twitter API methods will happily take the ID at the
end of the URL, but this one I'm trying to use doesn't.
I would appreciate any ideas or guidance on how to fix or work around
this problem.
Thanks,
Alex
I think this solution will work for me. Thanks for adding it in.
In some early use, it looks like it will be clunky to have to disable
appending before a call and enable after a call. I can't set it
globally since two of the methods I'm using need this switched on or
off. Something that could be less clunky would be a switch on the
client itself, like the switch for API version or REST vs. search API.
So the call would look like:
client[:no_append].alexanderkahn.23434.members! :id => 234234
Then I wouldn't have to worry about enabling/disabling. Hayes, what
are your thoughts on this?
Cheers,
Alex
> > client.rb#L215-223<http://github.com/hayesdavis/grackle/blob/master/lib/grackle/%0Aclien...>