It's all about the answers!

Ask a question

Quering User by userId using REST API

Michele Pegoraro (1.8k12114102) | asked Nov 02 '11, 6:52 a.m.
I was looking for a way to retrieve an user through REST API using his userId.

If I search a user with his name it works correctly with this command:

curl -k -L -b cookies.txt "http://myurl/ccm/oslc/users.json?oslc_cm.query=dc:title=%22TechUser%22%20&,rdf:resource,rtc_cm:userId"

and it also runs if I'm searching for the e-mail address:

curl -k -L -b cookies.txt "http://myurl/ccm/oslc/users.json?,rdf:resource,rtc_cm:userId"

But if I try using rtc_cm:userId

curl -k -L -b cookies.txt "http://myurl/ccm/oslc/users.json?oslc_cm.query=rtc_cm:userId=%22TechUser%22%20&,rdf:resource,rtc_cm:userId"

I get a 400 error which says that userId is an unknown attribute ID.

How can I run this query?


One answer

permanent link
Sandeep Somavarapu (1011) | answered Jun 28 '12, 5:15 a.m.
Hi Michele

RTC OSLC CM Service Provider supports queries on Change Request resources (which are work items here). But RTC does not expose the above Query URL that queries users (infact any other resource type). I mean there is no discovery path for these Query URLs. 

So for such query URLs some attributes are queryable and some are not. Priority to provide support for querying based on all attributes for other resource types is very low.

Being said that, The same query condition can be generated on a Change request resource. For example fetch me all change requests with user id is <>. Currently, it is a bug that this query is not working.

Here is the reference to work item where this is being tracked - 

Your answer

Register or to post your answer.