You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
import.java.net.HttpURLConnection
import java.net.URL
import java.util.Base64
URL url = new URL(http://crowd:8095/crowd/rest/usermanagement/1/user
con.setRequestMethod("POST")
def password = "password"
def username = "username"
def userpass = username + ":" + password
def basicAuth = "Basic:" + new String(Base64.getEncoder().encode(userpass.getBytes())
con.setRequestProperty("Authorization", basicAuth)
con.setRequestProperty(Content-Type", application/json; utf-8)
con.setRequestProperty("Accept", aplication/json)
con.setRequestProperty("Cache-Control","no-cache")
con.setRequestProperty("X-Atlassian-Token", "no-check")
con.SetDoOutput(true)
def body = "{\"name\": \"sampleuser\",\"password\":\"secret\",\"first-name\":\"sample\",\"last-name\":\"user\",\"display-name\":\"Sample User\",\"email\":\"sampleuser@user.cool\"}"
OutputStream os = con.getOutputStream()
byte[] input = body.getBytes("utf-8")
os.write(input,0,input.length)
log.warn(con.getResponseCode)
log.warn(con.getResponseMessage)
con.disconnect()
issue resolved. I replaced the body to
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.