Topic on Talk:Citoid

Tinss (talkcontribs)

When setting $wgCitoidServiceUrl to https://en.wikipedia.org/api/rest_v1/#!/Citation/getCitation, I get an XMLHttpRequest error in my browser when adding a citation and it seems citoid is querying this url with the old API. I'm using REL1_31 of the Citoid extension. Citoid/API, indicates that the API has changed. Is this change only available through restbase and not $wgCitoidServiceUrl?

We run a small wiki and figured we'd piggy back off Wikipedia's citoid service instead of hosting our own.

Thanks for any help!

Mvolz (WMF) (talkcontribs)

Yes, the "old" API is actually citoid's native API, and that's what wgCitoidServiceURL expects, but we deprecated the public version of that a few years back, and now we're only running the one behind restbase. If mw.config.get( 'wgVisualEditorConfig' ).fullRestbaseUrl exists, then it Citoid uses the restbase one, but I'm pretty sure if you set that in the VE config it will mess up the rest of your VE installation :).

Feel free to file a bug and/or submit a PR: https://phabricator.wikimedia.org/

In the meantime you could also just manually set fullRestbaseUrl here instead of getting it from the VE config: https://github.com/wikimedia/mediawiki-extensions-Citoid/blob/master/modules/ve.ui.CiteFromIdInspector.js#L109

Tinss (talkcontribs)

@Mvolz (WMF), I've managed to deploy restbase on my wiki and was wondering how to forward requests for /data/citation/{format}/{query} to https://fr.wikipedia.org/api/rest_v1/data/citation/{format}/{query}?

I've also noticed you've patched Citoid to have the option to make use of a public API behind restbase. Until that codes makes it past review, I'll try to use the aforementioned way.

Thanks a lot!

Mvolz (WMF) (talkcontribs)

fr and en wikipedia APIs perform identically, so there's probably no particular need to do that; internationalisation is not great, but what it does do is pass on the accept-language header. The content of the accept-language header is mw.config.get( 'wgContentLanguage' ) so as long as the content language of your wiki is fr, it'll get French when available.

Tinss (talkcontribs)

Thanks for the info! Any idea how I'm supposed to configure my local restbase to forward requests to another remote API?

Mvolz (WMF) (talkcontribs)

The change is merged, so you don't need to configure restbase, you should just be able to configure the citoid extension (if you update to 1.0.0): Citoid#Citoid extension

Nicolas NALLET (talkcontribs)