Wikidata/Notes/API: Difference between revisions

Content deleted Content added
Joancreus (talk | contribs)
No edit summary
m Reverted changes by Soteriaspace (talk) to last version by Lydia Pintscher (WMDE)
Tag: Rollback
 
(42 intermediate revisions by 10 users not shown)
Line 1:
The Wikidata API will simply be an extension of the existing [[mediawikiwiki:API:Main page|MediaWiki API]].
 
{{Message | type = attention | The API is documented on [[mw:Extension:Wikibase/API]] and in <code>api.php</code>. Actual URL will be depending on setup.}}
The following functions are being envisioned for Phase 1 (or even Phase 0.5, which is, for Wikimania. * means optional):
* <code>getData(id, *language)</code> - returns the data for a given ID. This is used by the Wikidata client extension. The language is set in order to add labels to the IDs.
* <strike><code>getIdByWikipedia(language, title)</code> - returns the ID of the page in Wikidata that corresponds to a Wikipedia article with the given title.</strike>
* <code>getDataByWikipedia(language, title, *language)</code> - This is used in order to give the data for a given Wikipedia article, based on the articles titles instead of the ID (it is basically a concatenation of getIdByWikipedia + getData). This allows the clients not to know about their corresponding IDs. The result is the same as for getData.
* <code>setWikipediaTitle(id, language, title, *badge)</code>
* <code>linkWikipedias(language-from, title-from, language-to, title-to)</code> (optional?) (basically a shortcut for getIdByWikipedia + setLanguageLink)
* <code>setLabel(id, language, label)</code>
* <code>setDescription(id, language, description)</code>
* <code>addAlias(id, language, alias)</code>
* <code>removeAlias(id, language, alias)</code>
* <code>searchByName(language, fragment, *hints)</code> (used for the Wikidata Suggest widget)
 
== Todo ==
Note, that the names need to be aligned with the existing naming policy.
 
=== Wikibase ===
*; <code>searchByName(language, fragment, *hints)</code> (: This is used forin the Wikidata Suggest widget), but a good text search facility isn't available for the moment.
; <code>setItem(data)</code> : This is a continuous work in progress, and the current version will probably not be the final solution.
 
=== Wikibase Client ===
; <code>changeSiteLinks( ( id XOR title ), changes )</code> : Gets called by the site links UI of the local wiki and contains a list of additions and removals which should be propagated to the repo. This is thus a proxy API module. Should look into immediately updating the local link list to not have to wait for the repo to run the job that will push the change back. In fact, we might want the repo to skip updating this client wiki altogether.
 
== See also ==
* [[Wikidata/Development/Phase 2 API]]
 
[[Category:Wikidata]]