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!