Are you sure this is complete? I see no session or
token cookies for
enwiki.
A-ha! Thanks, that was the key -- enwiki_session is sent only in the
initial response, so you need to merge, not overwrite, that with the
Set-Cookie from the second response. Here's the minimum set required:
{"centralauth_User"=>"Jpatokal",
"enwikiUserID"=>"8155",
"domain"=>".wikipedia.org",
"centralauth_Token"=>"8f57e36225df5a8f71cfd623718dff59",
"enwiki_session"=>"356044244f4316fbaadc42077ddecf4f",
"enwikiUserName"=>"Jpatokal",
"centralauth_Session"=>"32cc0e3f5d27c0135c4b8739b8d9e172"}
In Ruby:
def make_api_request(form_data)
RestClient.post(@wiki_url, form_data, @headers.merge({:cookies =>
@cookies})) do |response, &block|
...
@cookies.merge!(response.cookies)
end
end
Cheers,
-j.