Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var api = new mw.Api();
- api.get({
- action:'query',
- continue:'',
- meta:'tokens',
- format:'json'
- }).done(function(token) {
- api.post({
- action: 'wbcreateclaim',
- entity: 'Q4115189',
- property: 'P901',
- snaktype: 'value',
- token: token.query.tokens.csrftoken,
- value: {'entity-type': "item", 'numeric-id':1}
- }).done(function(data) {
- console.log(data);
- });
- });
- /*
- Error message
- {
- "servedby": "mw1131",
- "warnings": {
- "main": {
- "*": "Parameter 'value' uses unsupported PHP array syntax"
- }
- },
- "error": {
- "code": "param-missing",
- "info": "A parameter that is required was missing (A value needs to be provided when creating a claim with PropertyValueSnak snak)",
- "messages": [
- {
- "name": "wikibase-api-param-missing",
- "parameters": [],
- "html": {
- "*": "A parameter that is required was missing"
- }
- }
- ],
- "*": "See https://www.wikidata.org/w/api.php for API usage"
- }
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment