Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

problems changing email address on cloud using rest api

Jay Keck
Contributor
November 29, 2018

I had a script that ran on the server that would read in a file and change the email addresses of specific users. It worked great. I went to use it on the cloud and after changing the api syntax fo cloud access it still wasn't working. Is this 301 error due to the fact that Atlassian is phasing out usernames and they have removed api access to them? Or is it a dymb syntax error? Any help would be appreciated!

Thanks,

Jay

+ admin_user=admin
+ admin_password='pppppp'
+ user=jsmith
+ user_new_email=jjj.aaa@aol.com
+ url='http://myhost.atlassian.net/rest/api/2/user?key=jsmith'
+ headers='Content-Type: application/json'
+ data='{ "name": "jsmith", "emailAddress": "jjj.aaa@aol.com" }'
+ curl -verbose -s -o ssss -f -X PUT -u 'admin:pppppp' -H 'Content-Type: application/json' --data '{ "name": "jsmith", "emailAddress": "jjj.aaa@aol.com" }' 'http://myhost.atlassian.net/rest/api/2/user?key=jsmith'


* TCP_NODELAY set
* Connected to myhost.atlassian.net () port 80 (#0)
* Server auth using Basic with user 'admin'
> PUT /rest/api/2/user?key=jsmith HTTP/1.1
> Host: myhost.atlassian.net

> User-Agent: curl/7.53.1
> Accept: */*
> Referer: rbose
> Content-Type: application/json
> Content-Length: 59
>
} [59 bytes data]
* upload completely sent off: 59 out of 59 bytes
< HTTP/1.1 301 Moved Permanently                                      <===================
< Content-Type: text/html
< Date: Fri, 30 Nov 2018 00:33:25 GMT
< Location: https://myhost.atlassian.net/rest/api/2/user?key=jsmith
< Connection: Keep-Alive
< Content-Length: 0
<
* Connection #0 to host myhost.atlassian.net left intact

1 answer

1 accepted

0 votes
Answer accepted
Jay Keck
Contributor
November 30, 2018

I found my problem. I needed to use https vs http. Now I'm getting a 405 error, but it's progress.....

Suggest an answer

Log in or Sign up to answer