HUB, RestAPI, add existing user to group Follow
Completed
Hi all.
Can't add user to group in hub. I know Group ID, User login and User ID.
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.
Please sign in to leave a comment.
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"}'