How can I Bulk Create Multiple organization records using a single REST API call
Asked by Shabana Wollin:

Hi

I've researched for this on the community and I've not found a way yet - how can I bulk create multiple organization records as I have over 700+ and this would be very helpful.

Currently the POST call I'm using is rest/servicedeskapi/organization with this in the Body:

{  
"name": "test-0050"  
},

and when I use

{  
"name": "test-0050",

"name": "test-0051",

"name": "test-0052"  
},

I get a 400 - Bad Request error.

{  
"errorMessages": \[  
"Invalid request payload. Refer to the REST API documentation and try again."  
\]  
}


Answers:
author: Mikael Sandberg
body: Hi [@Shabana Wollin](/t5/user/viewprofilepage/user-id/4560720),

Welcome to Atlassian Community!

The endpoint only except a single organization as the payload, so the error you get is expected. What you can do is use something like Postman which allows you to [run a collection with imported data.](https://learning.postman.com/docs/collections/running-collections/working-with-data-files/)

comments: author: Shabana Wollin
body: I've not explored that - thank you. Can you let me know if this available only in Postman or would Talend API app also have a similar feature for running collections ?


author: Mikael Sandberg
body: I have never used Talend so cannot say if it has a feature that would allow you to run collections. But if it has a loop feature then you should be able to do it.


author: Shabana Wollin
body: Can someone let me know what the POST call should look like.

rest/servicedeskapi/organization (or)

rest/servicedeskapi/organization/name:{Organization Name}

I was able to use Postman and setup the collection to loop through the CSV file. However now I'm faced with a new issue - where it is not actually creating the organization from the CSV file.

I'm getting a 404 Not Found Error.

Upon reviewing the Request Response I see that it is formed correctly

{

"name": "test-1234"

}

thanks


author: Mikael Sandberg
body: Your post call should go to rest/servicedeskapi/organization and then in your body you will add the data. Something like this in Postman:

![Screenshot 2024-06-03 at 4.23.14?PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/327683i92BBE6A4C29E47F7/image-size/large?v=v2&px=999 "Screenshot 2024-06-03 at 4.23.14?PM.png")


author: Shabana Wollin
body: [@Mikael Sandberg](/t5/user/viewprofilepage/user-id/853579) I was able to fix the error I was getting - It was expecting for me to pass the Authorization token where I had it set to "Inherit from Parent" after I was doing a Get Organizations. After I changed the order of execution and added back the Authorization Token - I was able to get the Organization records created successfully - Thank you

Now, I am looking to Add The newly created Organization into my Service Project and I'm stuck at how to parse the POST URL successfully right after the create - do you have any suggestions or would I open a new thread for the question ? thanks.


author: Prince Nyeche
body: I believe you've figured out a way to do this in a loop. If you're not scripting a solution, the API call might not be as intuitive as required. However, why struggle with API when there are free apps that perform bulk creation of organization available on the Atlassian Marketplace?

comments: author: Shabana Wollin
body: Unfortunately we have a long process for getting Marketplace Apps approval and as I can manage how to script already - it gives me the ability to customize our requirements easily without having to rely on Apps.

I was also not aware of what Free Apps currently create organizations in bulk - I could check them out ? thanks


Tags: cloud

jira-service-management

jira-service-management-cloud