Create Group with Jira REST API


In the current documentation for Create Group in the JIRA Rest API:

I can't seem to find what to put in the payload or parameters for the POST command to /rest/api/2/group
I was wondering if I could get some help. 




1 answer

1 accepted


Try this in your post method:

{"name": "GroupName"}

I test with REST API Browser and it work fine. I normally use the groovy script to do stuff with the API.


Here is my example:

import static*
import groovy.sql.Sql
import static*

// JIRA Authorized user (Local)
JiraUsrName = ""        // JIRA Admin username
JiraPsw = ""            // JIRA Admin password

// JIRA API servers
def JIRAServer = "yourserver/jira"  // TheMan/jira (Do not put http)

println "" + System.getProperty("line.separator")
println "==============================="
println "Starting on: ${JIRAServer} Server"
println "==============================="

// Global Parameters
def httpAdd                      // Obj for the HTTPBuilder
def TestAddGroup = []            // Test Add Group
def Count = 0                    // Counter for loop

// Example data

// JIRA Rest API
httpAdd = new HTTPBuilder("http://${JIRAServer}/rest/api/2/group")
httpAdd.headers['Authorization'] = 'Basic ' + "${JiraUsrName}:${JiraPsw}".getBytes('iso-8859-1').encodeBase64()

// If found any groups
if ( TestAddGroup.size() ){

    // Add JIRA user to the tempo-approval group through the Rest API
    println ""
    println "=== :Groups are Being Added: ==="
    while( Count < TestAddGroup.size() ){
        httpAdd.request(POST, JSON){
            // Parse JSON data
            body = [
                name: "'" + TestAddGroup[Count] + "'"
            response.success = { resp ->
                println "Success! ${resp.status} : Added ${TestAddGroup[Count]}"
            response.failure = { resp ->
                if (resp.status == 400) {
                    println "Request failed with status ${resp.status} : User requested an empty group name or group already exists"
                } else if (resp.status == 401) {
                    println "Request failed with status ${resp.status} : The current jira user is not authenticated"
                } else if (resp.status == 403) {
                    println "Request failed with status ${resp.status} : The current user does not have administrator permissions"
                } else if (resp.status == 500) {
                    println "Request failed with status ${resp.status} : Operation is not permitted or error occurs while creating the group"
                } else {
                    println "Error : Error code is not match or jira may down"
                Count = TestAddGroup.size() + 1
} else { // No user found to add

    println "=== :No group to add: ==="



Thanks so much! :)

Do you have a groovy script to bulk create groups on JIRA?

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Sunday in Agility

You asked for it, so we delivered: images on issues have arrived

A picture tells a thousand words. And agility boards have just released their latest feature: cover images on issues – so now your board can tell a story at first glance. Upload attachmen...

772 views 3 11
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you