Zorglub27 added a comment.

so that's the code I'm using, with everything in the body, that created the 
`noentity` error

  breq = require 'bluereq'
  Promise = require 'bluebird'
  _ = require './utils'
  
  getCsrfToken = require './get_csrftoken'
  
  base = "https://www.wikidata.org/w/api.php";
  
  
  module.exports = (args...)->
    getCsrfToken
    .then createClaim.bind(null, args)
  
  createClaim = (args, authData)->
    [entity, property, value] = args
    { cookie, token } = authData
  
    url = _.buildUrl base,
      action: 'wbcreateclaim'
      format: 'json'
  
    body =
      token: token
      value: value
      entity: entity
      property: property
      snaktype: 'value'
  
    # CANT SEND A PROPER TOKEN IN THE BODY
    return breq.post requestParams(url, cookie, body)
  
  requestParams = (url, cookies, body)->
    headers =
      'Cookie': cookies
      'User-Agent': "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:39.0) 
Gecko/20100101 Firefox/39.0"
  
    headers['content-type'] = "application/json"
    headers['accept'] = "application/json"
  
    return req =
      url: url
      body: body
      headers: headers


TASK DETAIL
  https://phabricator.wikimedia.org/T109175

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Addshore, Zorglub27
Cc: Addshore, Zorglub27, Aklapper, Wikidata-bugs, aude, jayvdb, Anomie, 
Legoktm, Malyacko



_______________________________________________
Wikidata-bugs mailing list
Wikidata-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs

Reply via email to