User:Awah Nadege/Sandbox/Return values for action=edit API

From mediawiki.org

Overview[edit]

This page documents the response values and structures of API:Edit.

Response[edit]

The response can fall under three groups

  1. Redirect
  2. Edit
  3. Extension

Redirect[edit]

If the page to be edited is a redirect page, the title of the page is resolved to its target. A redirect page can therefore return the following results:

  • from: Source page title.
  • to: Target page title.

Edit[edit]

This gives information about the edit done on the page. The following can be returned:

  • result: success if the page was edited or failure if the edit was unsuccessful.
  • new: Type: bolean. Bolean is set to true if the edit created a new page. See [1] for details on how boleans function.
  • pageid: Type: integer. The ID of the edited page.
  • title: This attribute indicates the title of the edited page.
  • oldRevId: Type: integer. Revision ID before the page was edited.
  • newRevId: Type: integer. Revision ID after the page was edited.
  • newtimestamp: Type: timestamp; Format: ISO 8601. The time when the page was lastly edited.
  • nochange: Type: bolean. It is set to true when newRevId==oldRevId.

Extension[edit]

When action=edit API is used with Extension:ConfirmEdit, a captcha may be triggered for new edits. As a result, the return data could contain a captcha node.

  • result: Set to NeedCaptcha.

The values below depend on the captcha module used.

  • type: The type of captcha generated.
  • mime: Indicates the media type.
  • id: The captcha id.
  • The last value could be a question, a math problem, or a url to an image.