Skip to end of metadata
Go to start of metadata

Sometimes you just want a lot of test data injected into Jira and if you do not want to add Jira users manually here is a Python script that will create 1000 users. All users will be added to Jira Software application and 500 of these will also be added to Jira ServiceDesk application.

The script can be executed as is against a Jira running in theĀ Atlassian SDK where the administrator username and password is admin. If you have other credentials just change the BASIC_AUTH variable in the script.

You can use this script for other JIRA instances as well just be careful. I have tested this on Python 2. The script does not use Python libraries likeĀ Requests but uses Python built in modules.

Python 2 Create Jira Users
Create multiple users in JIRA via REST API
import json
import urllib2
import sys
import base64

USER_SIZE = 1000
JIRA_URL = "http://localhost:2990/jira/rest/api/2/user"
BASIC_AUTH = "Basic " + base64.b64encode("admin:admin")
HEADERS = {"Content-type": "application/json","Accept":"application/json","Authorization": BASIC_AUTH}

# Loop for creation
for user in range(0, USER_SIZE):
    name_suffix = str(user)
    app_keys = ["jira-software"]
    # Add JIra Servicedesk application
    if user % 2 == 0:
    POST_DATA = json.dumps({
        "name": "user_" + name_suffix,
        "password": "AbracadAbra",
        "emailAddress": "user_" + name_suffix + "",
        "displayName": "User_" + name_suffix + " " + "User_" + name_suffix + "_son",
        "applicationKeys": app_keys
    request = urllib2.Request(JIRA_URL, POST_DATA, HEADERS)
        contents = urllib2.urlopen(request).read()
        print contents
    except urllib2.HTTPError as e:
        print e