You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.
View groupJoin the community to find out what other Atlassian users are discussing, debating and creating.
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.
Can this be done and if it can how as I have tried all sorts of different ways to no luck.
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 must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @daniel
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 Script
IFS=","
OLDIFS=$IFS
read -p "Enter your Atlassian Email Address: " email
read -p "Enter your Atlassian API token: " token
# format : nexusfive not complete URL
read -p "Enter Atlassian Instance Name (e.g. nexusfive) : " ins_name
# Declare file path, using current directory
read -p "Enter the CSV File Name: " makefile
content="Content-Type: application/json"
function createOrg {
echo "Reading CSV File...Please wait"
cat $makefile | while read -r org
do
if [[ -n "$org" ]]; then
curl -s -u "$email":"$token" -d '{"name": "'$org'"}' -X POST -H "$content" "https://${ins_name}.atlassian.net/rest/servicedeskapi/organization"
echo -e "Organization $org created"
else
echo -e "Something went wrong, cannot create $org..." >> fail.txt
fi
done < $makefile
}
createOrg
echo -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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey @daniel
The problem is on line 10
Enter the CSV File Name: org upload.csv
the filename should not have space in it as the script doesn't validate anything. so you could rename the filename to org_upload.csv or upload.csv for simplicity and try again.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, I have changed the file to just upload.csv and still get the same problem?
Any other ideas?
Don't need to add anything else to the csv file?
Like
Col1. Col2. Col3
Value. Test1 Test2
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @daniel
Your CSV file should look like this with only a single column e.g:
col
Name 1
Name 2
Name 3
That's how the format should be
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok I get 2 types of errors
The first is that when I save from excel to csv file its not putting the commas in.
Reading CSV File...Please wait
{"errorMessages":["Illegal unquoted character ((CTRL-CHAR, code 13)): has to be escaped using backslash to be included in string value\n at [Source: org.apache.catalina.connector.CoyoteInputStream@325b19f4; line: 1, column: 20]"]}Organizati created000
Creation Complete..
If I open in a text editor to add in the commas I get the following error:-
{"errorMessages":["Unexpected end-of-input in VALUE_STRING\n at [Source: org.apache.catalina.connector.CoyoteInputStream@36176546; line: 1, column: 37]"]}Organi createdake4000,
this error looks like it prevents any or the preceding ones from being created
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @daniel
Since it's just a single column, you don't actually need a comma just create a file in a text editor with each name in a new line and save as .csv file as mentioned in my previous comment.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Prince Nyeche If I remove the commas I get the error :-
{"errorMessages":["Illegal unquoted character ((CTRL-CHAR, code 13)): has to be escaped using backslash to be included in string value\n at [Source: org.apache.catalina.connector.CoyoteInputStream@325b19f4; line: 1, column: 20]"]}Organizati created000
so not sure now how to get the CSV file to upload correctly
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Prince Nyeche Ok I have now managed to get it working.
The format I used was the below:-
Cat1
,
Cat2
,
Cat3
Not sure why it won't work without the comma and it does throw an error when processing the comma but it now puts these into the Helpdesk
:-) Happy now
Now to add them to the Helpdesk and then add the customers
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @daniel
Interesting, the script's IFS requires a comma that's why it looks for it. On unix systems this shouldn't be a problem for only a single column, however depending on what os system you're using I think it had to do with the CR (carriage return) or LF (line feed) or a combination as the data should just be on a new line but glad to know it works now when a comma was used in the new line. Have a nice day ahead
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
We often have questions from folks using Jira Service Management about the benefits to using Premium. Check out this video to learn how you can unlock even more value in our Premium plan. &nb...
Connect with like-minded Atlassian users at free events near you!
Find an eventConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.
Host an eventYou're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.