Function upload

  • Parameters

    • item: Item

      The item you want to upload to Wikidata

    • options: UploadOptions

      The options for uploading

      • summary

        The summary for the edit (displayed in the history of Wikidata)

      • tags

        The tags for the edit (displayed in the history of Wikidata)

      • authToken

        The token to use for authentication

      • anonymous

        If true, the upload will be anonymous

      • maxLag

        The max lag in seconds for the API request (see https://www.mediawiki.org/wiki/Manual:Maxlag_parameter)

      • server

        The API endpoint to use (defaults to Wikidata)

      • origin

        The origin to use for the API calls, aka the "domain" of the web app (only needed for CORS)

      • userAgent

        The user agent to use for the API request

      • axiosOptions

        The options to pass to axios

      • axiosInstance

        The axios instance to use for the upload. Defaults to axios

    Returns Promise<Item>

    A Promise for the item after uploading

    If no authentication method is provided or the upload fails

    const token = await getToken('your Wikidata username', 'your Wikidata password');
    upload(item, {
    summary: 'test update',
    authToken: token
    });