Perform bulk user Import for a tenant in wso2 products

Bulk user import is an Admin Service so it can only be performed by the tenant admin. In this post I am going to guide you how to perform a bulk user import as a tenant admin.

First you need to create a csv file or xlsx file which contains the user names. Here I am going to use a csv file. First lets create a csv file which contains user name that we need to add to the tenant.

UserNames
uhsani
ruwan
harsha
harin
ranil

NOTE:Please make sure to keep first line empty,start entering names as above from the second line.

then save the file as XXX.csv . Here I am using the file name as names.csv.

then create soap ui project with the wsdl

https://localhost:9443/services/UserAdmin?wsdl

Before this you have to set

 <HideAdminServiceWSDLs>false</HideAdminServiceWSDLs>

in the carbon.xml which can be found in PRODUCT_HOME/repository/conf

After creating the project you can see as following.

Selection_067

then select the operation bulk user import and create a request from it. create the payload as in the below image.

Selection_068

here the handler is the csv file. we have to send it as an attachment with the soap request. Now let’s attach the csv file to the soap request.

dia1

click on tab show in red circle 1 and click on icon in red circle 2 to open the csv file. Then it will prompt asking for caching the file ,click “No”.

Selection_069

Then click on the cell of the relevant row of your file which belongs column “part”, and you will see some values. select the value you have given for cid:XXXXXX in handler tag.

Since this is a admin service you have to pass tenant admin credentials.

Selection_070

click on the Aut tab and provide tenant admin details according to this figure. make sure Authorization type is set to Preemtive .

Now you are good to go… send the request .Now users in the csv file are added to the user store of the tenant with given default password in the payload.

Advertisements

3 thoughts on “Perform bulk user Import for a tenant in wso2 products

  1. Thnx, Bhathiya.. I think it is like a reference for the attachment. when you specify some number XXX as cid:XXXX in a particular tag that u want to send the attachment. you have to mention the same value in the part column of the attachment too. So that it can pick up correct attachment when more than one are there.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s