Page MenuHomePhabricator

liststudents API xml format is broken
Closed, ResolvedPublic

Description

As of (I think) the MediaWiki train deployment today, the liststudents API doesn't return valid XML: http://en.wikipedia.org/w/api.php?action=liststudents&courseids=481&format=xml&group

Event Timeline

Ragesoss raised the priority of this task from to Unbreak Now!.
Ragesoss updated the task description. (Show Details)
Ragesoss moved this task to Backlog on the MediaWiki-extensions-EducationProgram board.
Ragesoss added subscribers: Ragesoss, Anomie, Legoktm, AndyRussG.

:( Thank you for reporting this, @Ragesoss. I'm flagging it for the higher ups.

If you look at the JSON output , the trouble is with the keys that include spaces, "online volunteers" and "campus volunteers". The XML container tag name is mangled to "online.20.volunteers", but the entity records have an illegal tag name, "<online volunteer username...".

Looks like funky character handling needs to be fixed in the MediaWiki API.

Meanwhile, if this is a problem for the WikiEd dashboard or other consumers, can they be rewritten to hit the json endpoint? @Ragesoss, please let us know if there any consumers, so we can adjust the priority.

@awight: Yes, the dashboard uses xml at present. The mediawiki gem we use for API calls just uses xml, so it won't be trivial to switch that out. We definitely want to switch to json soon, but we'd rather have a little more time.

(I'm seeing if can work around it for just this broken endpoint. One hitch is that the json doesn't include some of the information that the xml includes: when there is a duplicated xml tag, it appears as a number in the json version. So the "course" and "reviewer" tags become integers.)

Change 207723 had a related patch set uploaded (by AndyRussG):
ApiListStudents: Use XML-friendly tag names

https://gerrit.wikimedia.org/r/207723

Change 207723 merged by jenkins-bot:
ApiListStudents: Use XML-friendly tag names

https://gerrit.wikimedia.org/r/207723

Change 207766 had a related patch set uploaded (by Anomie):
API: Also mangle indexed tag names in format=xml

https://gerrit.wikimedia.org/r/207766

Change 207778 had a related patch set uploaded (by AndyRussG):
ApiListStudents: Use XML-friendly tag names

https://gerrit.wikimedia.org/r/207778

Change 207779 had a related patch set uploaded (by AndyRussG):
ApiListStudents: Use XML-friendly tag names

https://gerrit.wikimedia.org/r/207779

Change 207778 merged by jenkins-bot:
ApiListStudents: Use XML-friendly tag names

https://gerrit.wikimedia.org/r/207778

Change 207779 merged by jenkins-bot:
ApiListStudents: Use XML-friendly tag names

https://gerrit.wikimedia.org/r/207779

Change 207766 merged by jenkins-bot:
API: Also mangle indexed tag names in format=xml

https://gerrit.wikimedia.org/r/207766

Change 207809 had a related patch set uploaded (by Legoktm):
API: Also mangle indexed tag names in format=xml

https://gerrit.wikimedia.org/r/207809

Change 207809 merged by jenkins-bot:
API: Also mangle indexed tag names in format=xml

https://gerrit.wikimedia.org/r/207809

Thank you @Ragesoss for the extra info. <3

Thank you @awight @AndyRussG @Anomie @Legoktm for your help. <3

You guys are superheroes. <3

The patch has been deployed to production wikis. Thanks,all! :)

<3 What a relief! Thanks all, indeed!! :)

One hitch is that the json doesn't include some of the information that the xml includes: when there is a duplicated xml tag, it appears as a number in the json version. So the "course" and "reviewer" tags become integers.

If that's actually a loss of information rather than just an irritating cosmetic difference, then the extension's output format is very poorly designed. The "indexed tag name" shouldn't carry any information, it's supposed to just be there as a container.

@Anomie I can take credit for that, as I pretty much blundered my way through creating the liststudents api. :-/

@Anomie: After looking it over yesterday, though, I don't think it actually loses any necessary information, as long as any consumer understands the format, and that "course" and "reviewers" will be implicit in json.