Explore: API responses across action and REST API should use have shared standard vocabulary that is used by all domains, modules, and extensions. The vocabulary should cover core concepts:
- page reference and page identity
- revision references
- user identity
- timestamp and expiry
JSON schema fragments for this vocabulary should be published on schema.wikimedia.org in a single file. They should be accessible from code using a single class.
Note that this is different from the shared error response schemas and also from standard pagination envelopes.
DoD: We have rough agreement on a mechanism to use in PHP, scope of the development work, and schemas for the fragments. This allows us to file tickets that break down the work for putting the mechanism into production. Refining and merging the patches attached to this ticket is not necessary for it to be completed. The patches serve the exploration, we may still decide to do something else.
Draft
Example data, following the event entity schema:
# NOTE: All fields are required, some are nullable. # page identity page: # ProperPageIdentity page_id: 1234 page_namespace: 1 page_title: Talk:John_Doe # Includes the namespace prefix, uses underscores nonexisting_page: # ProperPageIdentity page_id: 0 page_namespace: 0 # NS_MAIN page_title: Yadda_Yadda special_page: # PageIdentity page_id: null # cannot have a page ID. Separate schema?! page_namespace: -1 # That's the actual value of NS_SPECIAL in MediaWiki page_title: Special:Search # page reference (e.g. outgoing links) page_ref: # PageReference page_namespace: 1 page_title: Talk:John_Doe nonexisting_page_ref: # PageReference page_namespace: 0 page_title: Yadda_Yadda special_page_ref: # PageReference page_namespace: -1 page_title: Special:Search # revision reference rev_id: 1234 revision: # RevisionReference rev_id: 1234 page_id: 5678 # revision reference user: # UserIdentity user_id: 1234 user_name: "Joan Doe" # Note the space. The event schema uses "user_text". anon_user: # UserIdentity user_id: null # not 0, because it can't exist as a user account user_name: "123.123.123.123" system_user: # UserIdentity user_id: 0 user_name: "MediaWiki Default" # timespams timestamp: "2026-11-10T12:13:14Z" # ISO 8601. expiry_never: "infinity" # or infinite? indefinite? never?
Example data, with redundant prefixes removed:
# NOTE: All fields are required, some are nullable. # page identity page: # ProperPageIdentity id: 1234 namespace: 1 title: Talk:John_Doe # Includes the namespace prefix, uses underscores nonexisting_page: # ProperPageIdentity id: 0 namespace: 0 # NS_MAIN title: Yadda_Yadda special_page: # PageIdentity id: null # cannot have a page ID. Separate schema?! namespace: -1 # That's the actual value of NS_SPECIAL in MediaWiki title: Special:Search # page reference (e.g. outgoing links) page_ref: # PageReference namespace: 1 title: Talk:John_Doe nonexisting_page_ref: # PageReference namespace: 0 title: Yadda_Yadda special_page_ref: # PageReference namespace: -1 title: Special:Search # revision reference rev_id: 1234 revision: # RevisionReference id: 1234 page_id: 5678 # or just "page"? # revision reference user: # UserIdentity id: 1234 name: "Joan Doe" # Note the space. anon_user: # UserIdentity id: null # not 0, because it can't exist as a user account name: "123.123.123.123" system_user: # UserIdentity id: 0 name: "MediaWiki Default" # timespams timestamp: "2026-11-10T12:13:14Z" # ISO 8601. expiry_never: "infinity" # or infinite? indefinite? never?
Action API, for comparison:
# page identity page: pageid: 1234 ns: 1 title: Talk:John_Doe # Includes the namespace prefix, uses underscores nonexisting_page: pageid: 0 ns: 0 # NS_MAIN title: Yadda_Yadda special_page: pageid: 0 # Same as non-existing page ns: -1 # That's the actual value of NS_SPECIAL in MediaWiki title: Special:Search # page reference (e.g. outgoing links) page_ref: ns: 1 title: Talk:John_Doe nonexisting_page_ref: ns: 0 title: Yadda_Yadda special_page_ref: ns: -1 title: Special:Search # revision reference revid: 1234 revision: revid: 1234 pageid: 5678 # revision reference user: # UserIdentity userid: 1234 user: "Joan Doe" # Note the space. When listing users, the field is called "name". anon_user: # UserIdentity userid: null user: "123.123.123.123" system_user: # UserIdentity userid: 0 user: "MediaWiki Default" # timespams timestamp: "2026-11-10T12:13:14Z" # ISO 8601. expiry_never: "infinity" # or infinite or indefinite or never