[20:16:17] I'm wondering if I can get an article via pageid over the rest-api: https://de.wikipedia.org/api/rest_v1/#/ [20:17:18] pageids are a really internal thing to mediawiki [20:17:21] the rest api is external so unlikely [20:19:27] MW API can do it though: https://en.wikipedia.org/w/api.php?action=query&prop=info&pageids=10 [20:19:42] https://en.wikipedia.org/w/api.php?action=query&pageids=10 [20:21:39] if it's the html you want, you can always convert the pageid to a title as Krenair shows and use that [20:39:34] Krenair, I know that the php api can do it. I need to get the article intro. As titles change it's better to use the pageid in my own database. [20:40:29] if the page gets deleted and undeleted the page ID will change but not the title [20:40:47] there may be other unexpected behaviour around them too [20:41:27] Krenair, a well known wikisite won't get deleted I guess. The renaming is a big issue though. [20:41:43] wikisite? [20:41:48] you mean article? [20:41:52] yes. [20:42:21] wikisite is a good name, but not one i have heard before [20:43:02] empedokles78, you can get the article intro from the MW API too, using the page ID: https://en.wikipedia.org/w/api.php?action=query&prop=extracts&exintro&pageids=323710 [20:43:11] Dysklyver, let's place not start making up new terms [20:43:35] wikisite could very easily be a wiki rather than a single article [20:43:38] yes [20:44:10] do ay of you people know how to call an api via a web form? [20:44:10] Is the rest-api more of a beta api? [20:44:41] And which api is faster? [20:44:43] Dysklyver, you can create an HTML form that will GET/POST to the API, if that's what you mean [20:44:55] yes [20:45:17] empedokles78, they often do different things. RESTBase is supposed to add an extra layer of caching for some calls though I don't know details [20:45:26] only i can't figure out how, mainly beacuse it has to be a post request with attached json... [20:45:41] well you can certainly make an HTML form POST [20:46:05]
...
[20:46:45] if the JSON is pre-determined you can make an [20:46:48] If I have some database row of a company I want to link up with a wikiarticle, is the only reliable way the page id? [20:47:00] ok that sounds promising [20:47:08] i will try it out [20:47:11] or you can have the user input it like [20:47:30] empedokles78, I would use the title [20:47:35] if the page gets moved, a redirect should be left [20:49:29] Dysklyver, if you want to do something more complicated, i.e. maybe only part of the JSON should be user-determined, you might look into using JavaScript to handle that, though of course not everything will have JS enabled [20:49:35] Krenair, won't the page id be is still the same if the page is moved? [20:49:46] empedokles78, I wouldn't count on it [20:50:00] pageid seems like a primary key? [20:51:33] nothing stopping us from simply making a new page table entry for the new title and moving the revisions across, while transforming the old page into a redirect. I don't actually know off the top of my head what MW's current behaviour around this area is [20:53:11] https://www.mediawiki.org/wiki/Manual:Page_table#page_id says the page IDs stay the same when moves are done [20:53:26] so I assume the redirect page at the old title gets a new page ID allocated [20:54:39] this is a manual for the DB layout though, so I wouldn't count on it being a stable API [20:56:58] Krenair, it says page ids only change when pages are deleted and then restored. I guess renames are more frequent for business articles. [20:58:39] you can see the last 500 moves on enwiki here: https://en.wikipedia.org/w/index.php?title=Special:Log/move&limit=500 [21:01:37] Krenair, does it tell something about changing ids? [21:01:45] no [21:02:18] it was more in response to "I guess renames are more frequent for business articles." [21:04:32] ok the post request seems to work, now how do i get the response to display on the page? [21:04:40] the response is also json [21:05:36] Dysklyver, well if you're using an HTML to POST to the API, when the user clicks submit they should see the API response directly [21:06:02] Krenair, yeah I guess they are, as companies only get on wikipedia if some criteria are met and in my case they are large corps. [21:06:20] But sometimes they rename themself. [21:06:56] and sometimes wikpedia writes (corporation) in (). [21:07:18] if there are other articles with the same name. [21:07:32] yeah well there'll be a redirect so that shouldn't be an issue [21:07:48] or in the case of suffixes like (corporation), a disambiguation page [21:08:22] but I don't can get a textintro from such pages. [21:09:15] you can have the API automatically follow redirects for you if you want [21:10:32] compare https://en.wikipedia.org/w/api.php?action=query&prop=extracts&exintro&titles=AccessibleComputing with https://en.wikipedia.org/w/api.php?action=query&prop=extracts&exintro&titles=AccessibleComputing&redirects=1 [21:13:40] Krenair, okay. Hm.. also the json seems to focus on the page id, as it is it's main key. [21:15:00] have to look on it tomorrow again, thanks for your help. [22:40:37] Krenair, are you still there? [22:51:36] hi Dysklyver [22:52:27] so i have this: https://pastebin.com/h5Lpjmyn [22:52:44] is there an easy way to replace the image url in that json [23:01:42] uh [23:01:59] pretty sure you're supposed to be escaping that JSON to fit it into the HTML attribute [23:02:11] and yeah you can change the image URL [23:05:10] yes, i really have no idea what i am doing... [23:05:20] I will get there eventually