REST API related to python script development

Hi 

I'd like to add the users to the crucible groups by using of REST API.
This was requested by a Korea Customer urgently, so I was trying to develop some script with Python.

However, I can't put the users into the Crucible group.
Here is the source code what I've been developing so far.

Could you please advise which should be changed for that?
============================================
import requests
import json

username = "hyunjun.kim1"
password = "thddkwl12"
data = json.dumps(

{"name":"hyunjun.kim1"}

)
print(data)

r = requests.get('http://crucible.hynix.com:8060/rest-service-fecru/admin/groups/Amber-FlashSolution-users/users', 
auth=(username, password),
headers=(

{'content-type':'application/json', 'accept':'application/json'}

)
)

test = json.loads(r.text)[u'values']
print test

r = requests.put('http://crucible.hynix.com:8060/rest-service-fecru/admin/groups/Amber-FlashSolution-users/users', 
data,
auth=(username, password),
headers=(

{'content-type':'application/json'}

)
)

print r.status_code
============================================

Thanks.

1 answer

Hi Hyunjun Kim,

There is an example REST API Python client which covers user management.

https://bitbucket.org/atlassian/fecru-rest-examples/src/master/python/?at=master

create_user("example_user", "1234", "Example User", "example.user@gmail.com")
create_group("example_group")
add_user_to_group("example_user", "example_group")

Your usage of the REST API looks correct. What error are you getting?

mac

 

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Marketplace Apps

Tips on how to choose the best estimation method for your planning

Planning and grooming sessions all come with their own sets of rules. Team members meet to estimate stories or other work items, all according to an agreed-upon process. And with every session comes ...

71 views 0 11
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you