Per discussion at T228779. The target can already be checked manually by visiting the link, but this would make it easier.
Description
Details
Subject | Repo | Branch | Lines +/- | |
---|---|---|---|---|
Add API module to query targets | mediawiki/extensions/UrlShortener | master | +88 -2 |
Related Objects
Event Timeline
Why? Just look at the Location header.
km@km-pt ~> curl -i 'https://w.wiki/42' | grep location location: https://el.wikipedia.org/wiki/%CE%A0%CF%8D%CE%BB%CE%B7:%CE%9A%CF%8D%CF%81%CE%B9%CE%B1
Theoretically, sure. But not on Wikimedia sites because of CORS. What's the use case?
For example, a user wants to check if there is a link to a specific page already, without creating a new link if one doesn't exist
How would this API help with that? In that case you'd want to provide the long URL and see if any short code exists. But that's not a good use case anyways, because short URLs are so cheap, just create it.
Sorry, I meant check if a short url is already taken, because they may be waiting and hoping for a specific one (just as specific urls were assigned before the feature went live for everyone) - eg w.wiki/wiki. Or, it could be used to see how many have been created so far
After thinking a bit more, no, I don't think there's any downside. For other wikis that don't set up dumps, this could be a useful alternative. I would suggest that the API be named something like allshortcodes, and lists all codes. There would be a parameter like ascstart=... which allows for continuation, and people could use that get a specific one. Does that seem reasonable?
Change 528291 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/extensions/UrlShortener@master] Add API module to query targets
@Legoktm ping just want to make sure the patch provided is on your radar; I've addressed the issues you previously raised
Don't really have time to focus on this - will try to address the issues on the patch at some point, but if anyone else wants to take over feel free