MediaWiki: How to resolve "descriptionmsg" value retrieved via API? - mediawiki

Via http://en.wikipedia.org/w/api.php?action=query&meta=siteinfo&formatversion=2&format=json&siprop=extensions you can retrieve information about the MediaWiki extensions installed. The result format is documented at https://www.mediawiki.org/wiki/API:Siteinfo and states that for each extension descriptionmsg contains a system message name. This is not the description itself but a key to a description string.
My question is: I have the key from descriptionmsg, now how do I obtain the description string (via the API)?

MediaWiki has an API module in its action API called allmessages, it can be called like https://en.wikipedia.org/w/api.php?action=query&format=json&meta=allmessages&ammessages=centralauth-desc
Check out its documentation here: https://www.mediawiki.org/wiki/API:Allmessages

You can retrieve the contents of https://en.wikipedia.org/wiki/MediaWiki:[descriptionmsg_value]
Replace [descriptionmsg_value] with the actual value. For example given "descriptionmsg":"timedmediahandler-desc" the related page is https://en.wikipedia.org/wiki/MediaWiki:timedmediahandler-desc.
There are several ways to get the contents of a page. Refer to API:Get the contents of a page for more information.

Related

When embedding JSON in a Forge WorkItem, what specifies the name of the json file?

I'm following along here, under Additional notes, Input arguments:Embedded JSON, as well as the CountItApp code here (which I assumed was what was being referenced by the first link, but maybe that is a poor assumption?)
In any case, I see that in CountItApp\Main.cs, it is looking for a file called "params.json", but I'm having trouble locating where that name was specified when submitting the WorkItem. Is embedded JSON always called params.json, or is it specified somewhere that I'm missing? Or does it use the value specified in the "post" for the Activity (per the Activity example for InventorParams at that link)?
The name of the params.json is defined on the Activity. When you call the Workitem, the embedded JSON is passed as that parameter and saved with the name defined.

Get Data info from a certain page- MediaWiki API

I'm very new to the api system and i was wondering how to get data from a certain page. So my link is:
https://nookipedia.com/w/api.php
but i want to get my api from this page:
https://nookipedia.com/wiki/Bugs/Animal_Crossing:_New_Leaf
but when i try this:
https://nookipedia.com/wiki/Bugs/Animal_Crossing:_New_Leaf/w/api.php
the link doesn't work and gives me this error:
Error 404: Not found
The requested page or file could not be found on our server. It may have been moved or deleted.
How would i get that certain page?
I suggest you play around with the API sandbox on Wikipedia to see how queries are built. You will still need to read the actual API documentation to get useful information...
Basically, you want to pass the title(s) as a parameter to api.php, like so:
https://nookipedia.com/w/api.php?titles=Bugs/Animal_Crossing:_New_Leaf
However, this will still get you no information by itself; you need to know what data you want exactly, and use the correct API module with the appropriate parameters. For example, to get all the categories of a page:
https://nookipedia.com/w/api.php?action=query&titles=Bugs/Animal_Crossing:_New_Leaf&prop=categories
For this specific example, you can see the documentation for the Query API and the Categories property:
API:Query
API:Categories

How to get table data from Wikipedia page?

Is there somebody who knows how to use the Wikipedia API to get JSON or XML data out from a table on a specific Wikipedia page?
Is there maybe a different way to do this?
For example from here https://en.wikipedia.org/wiki/List_of_action_films_of_the_2010s
You can use curl (or use any other method/tool) to retrieve and/or parse a Wikipedia-URL via the public API. Here are two examples that should help you:
Retrieval of List_of_action_films_of_the_2010s:
JSON unparsed via the query action
JSON parsed via the parse action
Next, you would need to parse for and/or select the sub-elements relevant for your analysis. In this case I would assume: wikitable elements.
For reference and a detailed explanation, you can have a look at the general API page of MediaWiki and at the list of parameters on how to use the API to parse Wikipedia pages for certain data elements.

Can you get tag of a folder with box API?

Box allows you to create a tag for your folder, but how do you get that info out of the API? I don't see tag returning in the GET /folders/{id} API. Tag is not considered as a metadata either.
If you take a look at the Fields write up in the documentation it mentions that some fields are not returned by default. Within the docs they are listed in italics in objects, and have to be retrieved by adding a ?fields={field name} to your request.
The Folder Object has a tags parameter that you can fetch, but it is one of the ones not returned by default.
In this case, the API call would be GET /folders/{id}?fields=tags. One thing to note is that it will only return the tags in this case with some basic information (type of object and object id), not the full folder object. If you need other information in the call, you can add it to the fields that you want to pull. For example, if you wish to get the owned_by parameter as well, your request would be GET /folders/{id}?fields=owned_by,tags

How to access both images and extracts on a Wikipedia page via the API?

I am trying to access images and extracts on a Wikipedia page via the API.
According to the documentation, the way to do this is to add prop=images to the request URL.
api.php?action=query&titles=Albert%20Einstein&prop=images
But if I combine extracts and images
api.php?action=query&titles=Albert%20Einstein&prop=images&extracts
I get the following response
parsed_response={"warnings"=>{"main"=>{"*"=>"Unrecognized parameter: 'images'"}}
Each of these works individually. Combining other props (e.g., extracts&exintro&explaintext&redirects) also works.
Why can't I get extracts and images via a single API request?
It should be | in the place of &:
api.php?action=query&titles=Albert%20Einstein&prop=images|extracts
extracts&exintro&explaintext happens to work, because exintro and explaintext are not properties, but extra parameters that can be added when using prop=extracts. To combine them all, use
api.php?action=query&titles=Albert%20Einstein&prop=images|extracts&exintro&explaintext