Wikidata:Tools/WikibaseJS-edit
wikibase-edit, also known as WikibaseJS-edit, is a JavaScript library (Q783866) that simplifies the work of making a program or a script to make edits on Wikidata or any other Wikibase (Q16354758) instance.
Main Features
[edit]simplifies edits
[edit]For instance, to add a claim, instead of having to generate the following object (as expected by the Wikibase API)
{
"mainsnak": {
"snaktype": "value",
"property": "P569",
"datavalue": {
"value": {
"time": "+1802-02-26T00:00:00Z",
"timezone": 0,
"before": 0,
"after": 0,
"precision": 11,
"calendarmodel": "http://www.wikidata.org/entity/Q1985727"
},
"type": "time"
},
"datatype": "time"
},
"type": "statement",
"rank": "preferred",
"qualifiers": {
"P459": [
{
"snaktype": "value",
"property": "P459",
"hash": "795a0965a5fb08644610daba94b77779b68d45fa",
"datavalue": {
"value": {
"entity-type": "item",
"numeric-id": 15605,
"id": "Q15605"
},
"type": "wikibase-entityid"
},
"datatype": "wikibase-item"
}
]
},
"references": [
{
"snaks": {
"P854": [
{
"snaktype": "value",
"property": "P854",
"datavalue": {
"value": "http://www.senat.fr/senateur-3eme-republique/hugo_victor1354r3.html",
"type": "string"
},
"datatype": "url"
}
]
}
}
]
}
you will just need to generate the much simpler:
{ value: '1802-02-26', rank: 'preferred', qualifiers: { P459: 'Q15605' }, references: [ { P854: 'http://www.senat.fr/senateur-3eme-republique/hugo_victor1354r3.html' } ] }
validation
[edit]provides some local validation to help you figure-out what's wrong in your input in a more precise way than what the Wikibase API would have returned
authentication
[edit]handles authentication to the Wikibase API, either with a username and a password, or with OAuth credentials. See Config documentation.
other
[edit]- respects maxlag
Code
[edit]- Repository: https://github.com/maxlath/wikibase-edit
- License: MIT
Issues
[edit]To signal a bug or ask for help, you can open an issue at https://github.com/maxlath/wikibase-edit/issue
Documentation
[edit]See How To
Used by
[edit]- WikibaseJS-cli (Recent changes)
- inventaire.io (Q32193244) (Recent changes)
- Cocoda (Recent changes)
- Wiki Loves Monuments Italia (Recent changes)
- osmlab name-suggestion-index
- Cita
List of edits
[edit]Edits done by wikibase-edit use the WikibaseJS-edit
tag by default, which allows to get a list of edits done this way:
WikibaseJS-edit
in Recent Changes.