Wikibase/API/pt-br



O que é a API Wikibase
Wikibase fornece um mecanismo para armazenar declarações, como dados estruturados. As declarações sobre os itens estão no servidor do wikidata.org. Veja Wikidata:Glossary para mais informações sobre Wikibase e outros conceitos.



A API do Wikibase permite consultar, adicionar, remover e editar informações no Wikidata ou em qualquer outra instância do Wikibase.

Este é fornecido por meio de um conjunto de extensões para os módulos da API do MediaWiki. Portanto, para usar a API Wikibase, você deve ter uma familiaridade básica com a MediaWiki Action API: ações, consultas, etc., bem como com parâmetros genéricos como  e.



Como usar
Envie solicitações para a API por meio de HTTP, da mesma forma que com a MediaWiki Action API. See API:Tutorial#How to use it for information about how to use the MediaWiki Action API.

Request Format
The endpoint for the API is https://wikidata.org/w/api.php.

In the query string, add the action parameter, which tells the API which action to perform. For example,  tells the API to get the data for Wikibase entities. For meta and property submodules, use  and   respectively.

Some parameters are nearly always available. Plural forms are used in those cases in which a parameter can take several values. The parameters are:

GET request
Explanation of each part of the URL:


 * is the main endpoint.
 * tells the API to get the data for Wikibase entities.
 * means get the data from English Wikipedia.
 * indicates the title of the page to get data from.
 * indicates properties to get from the entities, in this case the property is the descriptions of the entities.
 * means filter the results down to the English language.
 * indicates JSON output, which is the recommended output format.

Response
The response of a request will usually contain:


 * A  key with a boolean cast as an integer if the request is successful. If the integer is zero, any additional values might be wrong.
 * An  key with an object of two, optionally three keys, ,   and  , if the request is unsuccessful.
 * Information about the action. The information is either passed on the top level or under item if it is one single item or items if it is several. If it is several items, each is found under a key with its own item id.

Empty objects are returned as JSON arrays and not as objects, while empty parameters remove the actual entry from the item.



Meta submodules

 * wikibase:
 * wbcontentlanguages:

Property submodules

 * pageterms:
 * wbentityusage:

API modules

 * wbgetentities:
 * wbavailablebadges:
 * wbcreateclaim:
 * wbcreateredirect:
 * wbeditentity:
 * wbformatvalue:
 * wbgetclaims:
 * wblinktitles:
 * wbmergeitems:
 * wbparsevalue:
 * wbremoveclaims:
 * wbremovequalifiers:
 * wbremovereferences:
 * wbsearchentities:
 * wbsetaliases:
 * wbsetclaim:
 * wbsetclaimvalue:
 * wbsetdescription:
 * wbsetlabel:
 * wbsetqualifier:
 * wbsetreference:
 * wbsetsitelink:
 * wbsgetsuggestions:
 * wbcheckconstraints:
 * wbcheckconstraintparameters:



Possíveis erros
Possíveis erros para qualquer módulo pode ser encontrado usando. The error format corresponds to that of the MediaWiki Action API. See API:Errors and warnings#Legacy format.

All error messages from the Wikibase modules should be internationalized (i18n) and localized (l10n). The user language for the logged-in user will be the default for error messages, but you can override this by adding  to the URL query string.

Additional notes
Wikimedia Commons has its own Wikibase for properties of the files on Commons.
 * Many Wikimedia wikis run the Wikibase Client extension. This lets API clients on them to query the  meta submodule to determine URLs for the full Wikibase repo, and the   property submodule to get some Wikidata information about pages on the local wiki.
 * The calender models that can be used with Wikibase are the Gregorian calendar(Q1985727) and the Julian calendar(Q1985786).
 * The API uses revision ids for edit collision detection. If there is an edit collision, the requester must acquire a newer revision id to be able to continue. This typically involves requesting  for the item in question, and then storing (and using) the revision from the entry.
 * Any MediaWiki installation can run Wikibase. On the Wikimedia cluster, most wikis do not run the full set of Wikibase extensions.
 * Do not test the  value for a particular error, instead use the   value as this will remain independent of localization.