HUB, RestAPI, add existing user to group

Completed

Hi all.

Can't add user to group in hub. I know Group ID, User login and User ID.

https://www.jetbrains.com/help/hub/HUB-REST-API_User-Groups_Users-of-User-Group_Add-User-to-Users-of-a-User-Group.html

I trying to:

curl -X POST https://hub.XXXXXXXX.ru/hub/api/rest/usergroups/56d36ddd-332c-3935-8182-d7f9e1e87782/users\?fields\=login -H "Authorization: Bearer perm:Xxxxxxxxxx=.yyyyyyyy==.VasdjuiuIUHuidhfguihi" -H "Content-Type: application/json" --data '{"login":"hubUserLogin"}'

but I got the error:

{"error":"Internal Server Error","error_code":500,"error_description":"child.id must not be null","error_developer_message":"child.id must not be null","error_uri":"https://www.jetbrains.com/help/hub/2018.2/HUB-REST-API.html"}

I must sent as a body the ALL users object?!

Thanks.

1 comment
Comment actions Permalink

I found solution.

I observe that when I got group via API there are objects users which consist of: type, id and login fields. So, these fields are enough to fill body for post, examle:

curl -X POST https://hub.XXXXXXXX.ru/hub/api/rest/usergroups/56d36ddd-332c-3935-8182-d7f9e1e87782/users\?fields\=login -H "Authorization: Bearer perm:Xxxxxxxxxx=.yyyyyyyy==.VasdjuiuIUHuidhfguihi" -H "Content-Type: application/json" --data '{"type":"user","id":"77a1d79f-4b72-4f2b-9294-bcd97ab3d7c2","login":"hubUserLogin"}'

 

0

Please sign in to leave a comment.