iwf
    Preparing search index...

    Function upload

    • Uploads an Item to a Wikibase instance (e.g., Wikidata)

      Parameters

      • item: Item

        The item you want to upload to Wikidata

      • options: UploadOptions

        The options for uploading

      Returns Promise<Item>

      A Promise for the item after uploading

      If input or response data fails Wikidata schema validation, no authentication method is provided, or the upload fails

      // Using BotPasswordAuth (recommended)
      const auth = new BotPasswordAuth({
      username: 'MainAccount@BotName',
      password: 'botpassword123',
      userAgent: 'MyBot/1.0'
      });
      await upload(item, {
      summary: 'test update',
      auth
      });
      // Anonymous upload
      await upload(item, {
      summary: 'anonymous edit',
      anonymous: true,
      origin: 'https://my-app.example.com',
      userAgent: 'MyApp/1.0'
      });