===== Jira API Shell Scripts ===== Below are some of the Jira API Shell scripts that I wrote that may be helpful === Add user === The script below can be used to add a user to Jira and then add them to a group. #!/bin/bash ######Define Variables ###### USERNAME="bobo" PASSWORD="D3F4U1Ti" EMAIL="mybobo@myjirainstance.com" FULLNAME="Bobo The Great Bobo" ######This function is used to setup JSON for the variables defined above to create a new user###### create_user(){ cat << EOF { "name": "$USERNAME", "password": "$PASSWORD", "emailAddress": "$EMAIL", "displayName": "$FULLNAME", "applicationKeys": [ "jira-core" ] } EOF } ######This function is used to setup JSON for adding user to a group###### generate_user_name(){ cat << EOF { "name":"$USERNAME" } EOF } ######This is the main curl calls using Jira API's###### curl -D- -u adminuser:adminPassword -X POST --data "$(create_user)" -H "Content-Type: application/json" http://FQDNURL/jira/rest/api/2/user curl -D- -u adminuser:adminPassword -X POST --data "$(generate_user_name)" -H "Content-Type: application/json" http://FQDNURL/jira/rest/api/2/group/user?groupname=users