Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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

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



0 votes


Accepted answer

Permanent link

 If there is no REST API for this, the Plain Java Client Libraries are available and can modify users.

See: 

Olivier ROSET selected this answer as the correct answer

0 votes

Comments

 Yep.

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

1 vote

 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

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

1 vote

Comments
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

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.

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

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.

0 votes

Comments

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

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

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

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 ?

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

 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.

0 votes

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 12,019
× 234

Question asked: Jun 11 '21, 7:11 a.m.

Question was seen: 2,370 times

Last updated: Jul 07 '21, 8:35 a.m.

Confirmation Cancel Confirm