Page MenuHomePhabricator

Timecard API changed from day_of_week to dayOfWeek?
Closed, ResolvedPublic

Description

Copied from https://www.mediawiki.org/wiki/Talk:XTools/API:

Did the timecard API change recently? I have code (which has been working for years) that calls https://xtools.wmflabs.org/api/user/timecard/en.wikipedia.org, expecting to get back a list of dicts containing 'day_of_week' elements. It's now crashing with:

KeyError: 'day_of_week'
Doing a manual call on the API route now gets me:

% curl -s https://xtools.wmcloud.org/api/user/timecard/en.wikipedia.org/Zaychikmoy | json_pp
{

"elapsed_time" : 0.02,
"project" : "en.wikipedia.org",
"timecard" : [
   {
      "dayOfWeek" : 1,
      "hour" : 0,
      "value" : 0
   },

...
i.e. what I was expecting to be "day_of_week" is now "dayOfWeek". RoySmith (talk) 19:20, 17 September 2026 (UTC)

This seems to be related to Commit 91a152c. If indeed the API did change as it appears, that's a breaking change.

XTools version: 3.26.1-8eb54752

Details

Event Timeline

My follow-up question would be: are there known clients that we would now break by changing back to snake case?

The change was unintentional, this happened because we renamed the field for coding convention reasons (having adopted eslint for JS recently) and the API passes along the array. I don't want to make a special case of not passing along the array as-is just for one field, so probably I guess we should normalize it to day_of_week and silence some linting in a few places.

That sounds like a good approach; I'll commit to either doing or reviewing the fix next week.

Change #1347632 had a related patch set uploaded (by Sohom Datta; author: Sohom Datta):

[labs/xtools@main] Revert "EditCounter: fix local-time breaking timecard"

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

Change #1347632 merged by jenkins-bot:

[labs/xtools@main] Revert "EditCounter: fix local-time breaking timecard"

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

Is there an estimate for when this fix will be deployed?

MusikAnimal subscribed.

Deployed! Sorry for the delay.

Thanks. I can confirm that my tool which depends on this is working again.