Expose structured Content information via the API prop=revisions
Open, Needs TriagePublic


Most custom content models have a custom representation of their data that can't be represented as plain text. Typically this is JSON. But the prop=revisions API can only output a serialization, which has to be text.

It would be nice if contenthandlers could output structured data (using ApiResult) instead of needing to create their own API modules.

This would theoretically let us fix T40971.

Legoktm created this task.Aug 26 2016, 2:51 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptAug 26 2016, 2:51 AM
Anomie added a subscriber: Anomie.Aug 26 2016, 1:51 PM

The most straightforward thing to do would be to add a method to Content (or possibly ContentHandler) to return a PHP object or array representation. An open question is whether this should be returning something with API metadata already present, or if it should be generic and the API should pass it through ApiResult::addMetadataToResultVars() if it's not specifically an object implementing ApiSerializable. In either case, the API can't currently support data with keys _element, _preservekeys, _type, _kvpkeyname, or _BC_bools.

Then ApiQueryRevisions and whatever else outputs a Content could take a prop=structuredcontent that would output this instead of the serialized version output by prop=content.

Change 307017 had a related patch set uploaded (by Legoktm):
[WIP] API: Output structured content representation if requested