I'm interested in creating bulk users in jira and confluence environments without purchasing plugin. Can you Please help me in this manner ...
You can do that using rest API mentioned here,
For example if your CSV structure is like like this,
name,fullname,email,password
You can write simple BASH or any other programming script (python, pearl, php, node) to read CSV file and send POST to request to above mentioned API request.
Here is sample in node js (we used to use it 1 year back)
// This code sample uses the 'request' library:
// https://www.npmjs.com/package/request
var request = require("request");
//file stream
var fs = require("fs");
//csv parser
var parse = require("csv-parse");
var fileName = "users.csv";
var csvData = [];
fs.createReadStream(fileName)
.pipe(parse({ delimiter: ":" }))
.on("data", function(csvrow) {
//console.log(csvrow);
//do something with csvrow
csvData.push(csvrow);
})
.on("end", function() {
//do something wiht csvData
//console.log(csvData);
});
csvData.forEach(function(data) {
var bodyData = `{
"password": "${data.password}",
"emailAddress": "${data.email}",
"displayName": "${data.fullname}",
"name": "${data.name}"
}`;
console.log(data);
console.log(bodyData)
var options = {
method: "POST",
url: "<JIRA_BASE_URL>/rest/api/2/user",
headers: {
Accept: "application/json",
"Content-Type": "application/json"
},
body: bodyData
};
request(options, function(error, response, body) {
if (error) throw new Error(error);
console.log(
"Response: " + response.statusCode + " " + response.statusMessage
);
console.log(body);
});
});
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.