Jump to content

XTools/API

From mediawiki.org
Please first review the Action API and REST API to see if they meet your needs. These will be considerably faster than XTools and allow for asynchronous requests.

The XTools features a rich API for much of the data available through the web interface. Out of courtesy we ask you make requests synchronously – as in one full round trip – before making a new request. Please leave an informative user agent in your request so we can contact you if we need to.

Errors and warnings

Error messages are in the format specified by RFC 7807, with at minimum status, title and details properties.

Please log any responses with a warning property as this will announce deprecations and future changes.

To ensure performance and stability, most endpoints related to users will return a 501 response code if the user has made an exceptionally high number of edits. In the future, requests for such users may be permitted but will require authentication.

Endpoints

Change log

3.21.0 (upcoming)

Page API

  • /api/page/pageinfo endpoint
    • The last_edit_id property will be removed. Use the modified_rev_id property instead.
    • The author and author_editcount properties will be removed. Use the creator and creator_editcount properties instead.
    • The ip_edits property will be removed. Use the anon_edits property instead.

3.20.0 (2024-08-15)

Common to all APIs

  • All timestamp properties are now returned as ISO 8601 in the form of YYYY-MM-DDTHH:MM:SSZ.
  • page_title and full_page_title always return values with underscores replaced with spaces.
  • minor and reverted properties are always boolean instead of 0 or 1.

Page API

  • The /api/page/articleinfo endpoint has been renamed to /api/page/pageinfo.
    • The watchers property returns null instead of zero if the number of watchers is unknown.
    • The author and author_editcount properties have been renamed to creator and creator_editcount, respectively.
    • The last_edit_id property has been renamed to modified_rev_id.
    • The created_at and modified_at properties are returned as ISO 8601 in the form of YYYY-MM-DDTHH:MM:SSZ.

User API

  • The /api/user/category_editcount endpoint property categories is always returned as an array, even if there's only one element.
  • The /api/user/month_counts endpoint gives the totals as an array keyed by namespace and then year/month in the format YYYY-MM, with the count as the values.

3.18.0 (2023-07-10)

Version 3.18.0 introduced the first OpenAPI Specification of the XTools API. For the sake of consistency, many of the endpoints now have new standardized responses, and a few endpoints have been renamed or removed. XTools 3.18.0 was released on July 10, 2023.

Here is a summary of the breaking changes:

Common to all APIs

  • All page_namespace properties are now named namespace.
  • All page_is_redirect properties are now named redirect, and this returns a boolean, not an integer.
  • All rev_timestamp properties are now named timestamp.

Project API

  • The /api/users_groups and /api/admins_groups endpoints have been removed. Use /api/admin_groups, /api/patroller_groups and /api/steward_groups instead.
  • The /api/project/automated_tools endpoint results are now nested under the tools property.

Page API

  • The /api/articleinfo endpoint is removed. Use /api/page/articleinfo instead.
  • The /api/page/assessments endpoint results are now nested under the pages property.

User API

  • The /api/user/automated_tools endpoint has been removed. Use /api/project/automated_tools instead.
  • The /api/user/pages_count endpoint now always groups results by namespace, even if a specific namespace was provided. Before, it only grouped by namespace if all was provided as the value for the namespace parameter.
  • The /api/user/pages endpoint
    • Now always groups results by namespace, even if a specific namespace was provided. Before, it only grouped by namespace if all was provided as the value for the namespace parameter.
    • Each page has the properties deleted (whether the page is deleted or not), namespace, page_title, full_page_title, redirect (boolean), timestamp, rev_id, rev_length, length (current length of the page), recreated, and assessment (with keys class, badge, color and category).
    • pa_importance property is no longer included, as this represents the importance level of only a single WikiProjects and not the page overall.
    • human_time and raw_time properties are removed. Use timestamp instead and do your own formatting as desired.
    • badge_file property has been removed.
  • The /api/user/top_edits endpoint
    • Now returns the full_page_title property instead of page_title_ns.
    • The pa_class property is replaced by assessment, which has the keys class, badge, color and category.
    • The rev_deleted property has been removed.
    • The reverted property is now a boolean instead of an integer.
    • The minor property is now a boolean instead of an integer.

Errors

  • All fatal errors (not warnings) are in the format specified by RFC 7807, with at minimum status, title and details properties. Warnings are still be an array under the warning property.