It's all about the answers!

Ask a question

RTC REST or OSCL API : how to archive a user / contributor ?


Olivier ROSET (507) | asked Jun 11, 7:11 a.m.

 I would like to know how I can programmaticly archive a user in RTC by calling a REST API or OSLC API



Accepted answer


permanent link
Ralph Schoon (58.4k23642) | answered Jun 28, 6:47 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Olivier ROSET selected this answer as the correct answer

Comments
1
Olivier ROSET commented Jul 07, 8:34 a.m.

 Yep.

Done by using the Java api. IContributor class have a setArchived(boolean arg) method very usefull for the job. Thanks.


Olivier ROSET commented Jul 07, 8:35 a.m.

 Yep.
Done by using the Java api. IContributor class have a setArchived(boolean arg) method very usefull for the job. Thanks. 

3 other answers



permanent link
David Honey (3256) | answered Jun 21, 5:38 a.m.
JAZZ DEVELOPER
edited Jun 21, 5:38 a.m.

You can find documentation on the foundation users API referenced from


You can query for users using a GET on contextRoot/users?query=query
The syntax of the query is described in https://jazz.net/wiki/bin/view/Main/JFSApplicationQueryLib#Query_Syntax
The syntax seems similar to OSLC query, but the API is not an OSLC query capability.
For example, you might use a query string (unencoded) of foaf:name="Firstname Lastname" or foaf:mbox="user@domainname.com".
Remember that query parameters should be URL encoded. For example:
GET  https://jazz.net/jazz/users?query=foaf%3Aname%3D%22Firstname%20Lastname%22

The response is an atom feed with mime type application/atom+xml


Comments
Olivier ROSET commented Jun 22, 4:11 a.m.
Thanks for the answer. That can help. But, the first 2 links are not available to average users. :)  I can't read them.
I got a error message after my loggin on the web site when I try to read those links :

Error!
You may not have rights to access the item


David Honey commented Jun 22, 5:54 a.m. | edited Jun 22, 5:54 a.m.
JAZZ DEVELOPER
Hi Olivier,

Sorry about that. The work item and its attachment are in a private project area. I think there's some concern that the user data might be sensitive. Having said that, there is a people picker in the UI that a user can use to find out names and email addresses of other users in that JTS.

Try the query example in my earlier comment. It worked for me.

Another possibility is to query for users in Lifecycle Query Engine. If you have a federated deployment, that can give you details of users across all the JTSs that are being indexed.

David Honey commented Jun 22, 5:59 a.m.
JAZZ DEVELOPER

You can also try looking at the history of the Wiki page: https://jazz.net/wiki/bin/rdiff/Main/JFSUsersAPI?type=history. Not sure if you have access to that.


permanent link
David Honey (3256) | answered Jun 11, 8:59 a.m.
JAZZ DEVELOPER

Have you tried a GET followed by a PUT?

For example: GET <userUri> with Accept=application/rdf+xml
This might provide:

<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:jfs="http://jazz.net/xmlns/prod/jazz/jfs/1.0/"
    xmlns:foaf="http://xmlns.com/foaf/0.1/">
  <rdf:Description rdf:about="https://clmwb.com:9443/jts/users/TestJazzAdmin1">
    <foaf:mbox rdf:resource="mailto:jazzdt@info.com"/>
    <foaf:nick>TestJazzAdmin1</foaf:nick>
    <foaf:name>TestJazzAdmin1</foaf:name>
    <jfs:archived rdf:datatype="http://www.w3.org/2001/XMLSchema#boolean"
    >false</jfs:archived>
    <rdf:type rdf:resource="http://xmlns.com/foaf/0.1/Person"/>
  </rdf:Description>
</rdf:RDF>
    
Change the jfs:archived property to true, then perform a PUT.
Try that.


Comments
Ralph Schoon commented Jun 11, 9:57 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

He probably does not know how to discover the base URI to find users etc. David. It is not obvious. 


Olivier ROSET commented Jun 21, 3:36 a.m.

Yep. Good guess. :) How can I get the base URI for a particular user ?  


Olivier ROSET commented Jun 22, 8:57 a.m.

Don't forget to get the etag returned in the GET response header and put it in the PUT call header ! 


Olivier ROSET commented Jun 25, 6:49 p.m.

Precision : The PUT or PATCH methods are not supported by this url.

Calling it with PUT give you a answer like this : 
Error 405: HTTP method PUT is not supported by this URL

If you call it with OPTIONS instead of GET, you get a response like this in the header: 
allow: GET, HEAD, POST, TRACE, OPTIONS :

Any other id for changing a attribute by the OSLC RESP API ?


David Honey commented Jun 28, 5:30 a.m.
JAZZ DEVELOPER

The original documentation on the Wiki says:

User Write Access

This service provides read-only access to user resources, and while future versions may provide the ability to create, update and delete user resources today this must be accomplished through the Jazz administration web UI.

So it looks like there is no public REST API to support modifying JTS users.
You will have to use the web UI


permanent link
Ralph Schoon (58.4k23642) | answered Jun 21, 5:03 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

 I have searched this forum and find the users API confusing. 


The CCM Rootservices.xml lists 

<jfs:users

This returns 405 if called. You can call it using https://elm.example.com:9443/jts/users/<userID> and then you get the user and can modify it. (header only accept required, I used application/rdf+xml) 

I can get the users by calling https://elm.example.com:9443/ccm/oslc/users with an accept header like above and header OSLC-Core-Version 2.0. This provides me with the JTS links for all the users. I wonder where I could discover this information.

The reportable rest is also listed in several examples to allow getting the users, especially in the context of project areas.

Your answer


Register or to post your answer.