It's all about the answers!

Ask a question

Changing Admins through REST API


Sylvain LEQUEUX (2132728) | asked Nov 03 '11, 8:36 a.m.
Hello,

I have a project area created in my RRC 2.0.0.4.

I'm trying to set members roles using the REST API but I get a 403 (Permission denied) if I'm not declared as an administrator of this project (even if I'm JazzAdmins).

So, I would like to add myself as an Admin like it could be done in the Web UI. When I call the project-area service, I get this :

<?xml version="1.0" encoding="UTF-8"?>
<jp06:project-areas xmlns:jp06="http://jazz.net/xmlns/prod/jazz/process/0.6/">
<jp06:project-area jp06:name="Test">
<jp06:summary/>
<jp06:description/>
<jp06:url>https://<jazzServer>:9444/jazz/process/project-areas/_RHr8cbWrEd-cLqUVQuRb1g</jp06:url>
<jp06:roles-url>https://<jazzServer>:9444/jazz/process/project-areas/_RHr8cbWrEd-cLqUVQuRb1g/roles</jp06:roles-url>
<jp06:links-url>https://<jazzServer>:9444/jazz/process/project-areas/_RHr8cbWrEd-cLqUVQuRb1g/links</jp06:links-url>
<jp06:members-url>https://<jazzServer>:9444/jazz/process/project-areas/_RHr8cbWrEd-cLqUVQuRb1g/members</jp06:members-url>
<jp06:archived>false</jp06:archived>
</jp06:project-area>
</jp06:project-areas>


I can't see the admins service for this project (in RTC 3.0.1, I am able to get one but not in RRC 2.0.0.4). I also observed HTTP headers using the Web UI and I can see that it is using a service named com.ibm.team.process.internal.common.service.IProcessRestService.

Is there a way to get the admins service or a documentation that explains how to use the IProcessRestService ?

Regards,
Sylvain

2 answers



permanent link
Tom Mutdosch (1761) | answered Nov 15 '11, 5:30 p.m.
JAZZ DEVELOPER
Hi there,

Yes I am not sure where the Admin assignment is exposed via REST API. Here's the link to the Process specification:
https://jazz.net/wiki/bin/view/Main/DraftTeamProcessRestApi?rev=4

However the user should not need to be an administrator to set roles. Is your current user (that you are trying to use) a Member of the project with Administrator role?

Can that user assign roles via the Web UI but just not via the REST APIs?

-Tom

permanent link
Sylvain LEQUEUX (2132728) | answered Nov 16 '11, 3:36 a.m.
Hi,

Thank you for your reply.

The user I am using is not declared as a member nor an admin of the project but has the JazzAdmins rights.

I'm able to add an admin through web UI but not using the API you linked here (it was what I used and I didn't get admins-url).

Nevertheless, I found the service used by the Web UI :

First, I get the itemID of a contributor (GET http request) :
https://{host}{:port}/jazz/service/com.ibm.team.repository.service.internal.IAdminRestService/contributors?

searchTerm={contributorID}&pageSize=50&sortBy=name
&sortOrder=asc&hideAdmin=true&hideGuest=true
&hideUnassigned=true&pageNum=0&hideArchivedUsers=true


Then, I get a stateID for the project area (GET http request) :
https://{host}{:port}/jazz/service/com.ibm.team.process.internal.common.service.IProcessRestService/projectAreaByUUID?uuid={project area UUID}


Finally, I add the admin to the project (POST http request) :
https://{host}{:port}/jazz/service/com.ibm.team.process.internal.common.service.IProcessRestService/projectArea

With POST parameters set to :
- itemId : the project Area UUID
- stateId : the project Area state ID
- jsonMembers : {}
- jsonAdmins : {"add":["the contributor ItemID"]}
- processLocale : fr
- publicVisible : true
- memberVisible : false
- specificUserVisible : false


This works but it's not using a service found through the rootservices document so I just assume it's a workaround cause I would prefer not building URI on my own.

So, if someone knows how to make it in a better way, I'll be glad to see his solution.

Regards,
Sylvain

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.