Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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}' // String now
- }).done(function(data) {
- console.log(data);
- });
- });
- /*
- Error message
- {
- "servedby": "mw1231",
- "error": {
- "code": "invalid-snak",
- "info": "Invalid snak (Can only construct StringValue from strings)",
- "messages": [
- {
- "name": "wikibase-api-invalid-snak",
- "parameters": [],
- "html": {
- "*": "Invalid snak"
- }
- }
- ],
- "*": "See https://www.wikidata.org/w/api.php for API usage"
- }
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment