I am trying to create a new user without any groups or any specificity, just a simple user.
I am a site administrator on Jira Cloud.
Here is what I tried on the script console:
def createUser = post("/rest/api/2/user")
.header('Content-Type', 'application/json')
.body([
emailAddress: 'email2@test.test',
name: 'testuser2',
displayName: 'test user2'
])
.asObject(Map)
if (createUser.status != 400) {
return createUser
}
Here is what the logs give me:
Serializing object into 'interface java.util.Map' POST request to /rest/api/2/user returned an error code: status: 401 - Unauthorized body: [errorMessages:[You are not authenticated. Authentication required to perform this operation.], errors:[:]] POST /rest/api/2/user asObject Request Duration: 762ms
Thank you for your help!
Hi Constance,
Thank you for your question.
I can confirm that the Create user rest API call which is documented inside of the API documentation here states that this rest call is not permitted to be made from APP's meaning that ScriptRunner for Jira Cloud will be unable to execute this rest call.
This means that currently inside of the cloud version it is not possible to create a script to programmatically create a user using ScriptRunner for Jira Cloud as we only support rest calls which are permitted apps being allowed to access the rest resource.
If this response has answered your question can you please mark it as accepted so that other users can see it is correct when searching for similar answers.
Regards,
Kristian
What a horrible news!
Thank you for you answer, that's the line I missed!
If you have any idea on how to work around this please don't hesitate!
Best
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey do you have a scriptrunner script to create user in jira cloud ?
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.