Hi ,
I am trying to create several organizations with one api call but keep getting the 404 error.
Whilst I understand this has been raised a few times it was mentioned in the below post or hinted at this can be done.
https://community.atlassian.com/t5/Jira-Service-Desk-questions/How-to-bulk-import-oganizations-in-my-projects/qaq-p/1341574
Can this be done and if it can how as I have tried all sorts of different ways to no luck.
Hi @daniel
You can use the API endpoint to bulk create those several organizations.
Can you give an example of how to create multiple organisations with 1 API call.
I can create using the API endpoint but currently have to do one call at a time, I might as well create it one at a time within the Helpdesk itself if I can't create several in 1 api call.
You can create a csv file with a single column of the organization name as much as you want and use this shell script to run every name in a loop. it's a simple script that does it in one go.
#!/bin/bash# create JSD Org's ScriptIFS=","OLDIFS=$IFSread -p "Enter your Atlassian Email Address: " emailread -p "Enter your Atlassian API token: " token# format : nexusfive not complete URLread -p "Enter Atlassian Instance Name (e.g. nexusfive) : " ins_name# Declare file path, using current directoryread -p "Enter the CSV File Name: " makefilecontent="Content-Type: application/json"function createOrg {echo "Reading CSV File...Please wait"cat $makefile | while read -r orgdoif [[ -n "$org" ]]; thencurl -s -u "$email":"$token" -d '{"name": "'$org'"}' -X POST -H "$content" "https://${ins_name}.atlassian.net/rest/servicedeskapi/organization"echo -e "Organization $org created"elseecho -e "Something went wrong, cannot create $org..." >> fail.txtfidone < $makefile}createOrgecho -e "Creation Complete..."IFS=$OLDIFS
Save the file as an .*sh extension and use. if you're on window use the Cygwin software or the Linux bash App from the Marketplace.
Hi, Thats brill thanks for this.
I have managed to run the script, however whilst it states Creation complete, they are not actually created in the helpdesk.
I would expect the below to appear before the creation complete echo
echo -e "Organization $org created"
Any ideas on where it could be going wrong? I am not getting any more errors?
After running here is the response:-
Enter your Atlassian Email Address: ballingerdaniel@mail.com
Enter your Atlassian API token: Token
Enter Atlassian Instance Name (e.g. nexusfive) : gloucester4894
Enter the CSV File Name: org upload.csv
Reading CSV File...Please wait
Creation Complete...
It looks like you're new here. Sign in or register to get started.