I recently noticed that the maximum expiry value for action=watch is 1 year.
A similar thing is mentioned in T306198, but I wonder why this limitation even exists?
If we specify an expiration time of more than 1 year, that gives us a warning message:
mw.loader.using('mediawiki.api', function() { if (!confirm('Continue?')) return; new mw.Api().postWithToken('watch', { action: 'watch', titles: 'Main page', expiry: '3 years', formatversion: '2' }).then(function(res) { console.log(res); }).catch(function(code, err) { console.log(err); }); });
{ "batchcomplete": true, "warnings": { "watch": { "warnings": "Given value \"3 years\" for parameter \"expiry\" exceeds the maximum of \"1 year\". Using maximum instead." } }, "watch": [ { "title": "Main page", "ns": 0, "expiry": "2024-05-08T02:01:13Z", "watched": true } ] }
I think it would be best if we could specify an expiration time of any duration. This is because, at least on my local project (jawiki), we often protect pages for more than 1 year (mostly 3 years or so) when we need to make countermeasures against LTAs. With the max watchlist expiration time of 1 year, we can't surveil the relevant pages in the most effective way. I believe that this is worth considering (or at least, API documentation pages should mention this maximum expiration time).