Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

0 votes

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
TAGS
Community showcase
Published in Bamboo

Bamboo Data Center Apps Program coming soon

G’day Bamboo customers, As we approach GA for Bamboo Data Center , we would like to inform you that the Data Center Apps Program for Bamboo starts this quarter. How long does it take? We are g...

52 views 0 4
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you