A partial archive of https://discourse-mediawiki.wmflabs.org as of Saturday May 21, 2022.

Data returned by the query API does not say if a link is a red link or not

Senthilsaivam

Hi,

The API mentioned below does not indicate if a link is red (there is no page with that title yet).

https://simple.wikipedia.org/w/api.php?format=json&action=query&prop=revisions&rvslots=*&rvprop=content&titles=west

Is there any way to get this information via the API’s? If not, can this be taken as a feature request?

cheers,
senthil

thiemowmde

It seems what you get via this API is the raw, unparsed wikitext. You probably want to try the parse API out (see https://www.mediawiki.org/wiki/API:Parsing_wikitext), or query the titles you are interested in directly.

Tgr

Are you looking for generator=links?

Senthilsaivam

Thanks @Tgr , generator=links does give the data on which linked titles are missing for a given title.

Is there a way to get the content for the given title and the link information in one single API call?

The below call gives the content for all the titles linked from the “west” title but does not include the content for the “west” title itself.
https://simple.wiktionary.org/w/api.php?format=json&action=query&prop=revisions&rvslots=*&rvprop=content&titles=west&generator=links&gpllimit=max

Tgr

I don’t think that’s possible.

srishakatux

Example of fetching missing links with sample code recently got added here: https://www.mediawiki.org/wiki/API:Links#Example_2:_Fetch_missing_links.