Wikimedia Developer Support

Editing with CAPTCHA


#1

Hi. I’m an intern, working on improving the documentation for the action API. Part of my task involves writing sample code. I am currently working on API:Edit, and am unsure how to handle CAPTCHAs if my sample is run. If someone is using the action API to edit a page, and they get a CAPTCHA in response, how do they complete the edit?

I know v1.17 and below had the captchaid and captchaword parameters, which could be appended to the original query and resent, but these two parameters were deprecated in v1.18…


#2

There will be a captcha field with various subfields. It depends on the type of captcha used. For Wikimedia sites that would be FancyCapctha, so something like

{
    type: 'image',
    mime: 'image/png',
    id: <captcha id>,
    url: <captcha image URL>,
}

and then you pass back some fields, typically captchaid and captchaword but it also depends on the type of captcha used. The generated API help should describe the field names and how they are to be used.

Note this is not part of MediaWiki’s edit API by default, it’s added by the ConfirmEdit extension. See SimpleCaptcha::addCaptchaAPI() and see SimpleCaptcha::apiGetAllowedParams() and their various reimplmentations in subclasses.


#3

Ok. The current page mentions ConfirmEdit adding parameters, but I did not understand what that meant for the user. This makes it more clear: although deprecated from the base version of the Edit API, if ConfirmEdit is installed, they are still available. They’ve been handed off to the extension.