Quering User by userId using REST API
![](http://jazz.net/_images/myphoto/64dd52320b9af5c92b76f5a38ad571f5.jpg)
Hi,
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:
and it also runs if I'm searching for the e-mail address:
But if I try using rtc_cm:userId
I get a 400 error which says that userId is an unknown attribute ID.
How can I run this query?
Thanks,
Michele.
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&oslc_cm.properties=dc:title,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?oslc_cm.query=rtc_cm:emailAddress=%22TechUser@email.me%22%20&oslc_cm.properties=dc:title,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&oslc_cm.properties=dc:title,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?
Thanks,
Michele.
One answer
![](http://jazz.net/_images/myphoto/64dd52320b9af5c92b76f5a38ad571f5.jpg)
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 -