On 26/03/2018 07:14, Ravindra Singareddy wrote:
Hi All,
I need to read user by username, email or key(uuid) with the admin
user. What will be best approach?
I have used following code but giving "Could not find an Access Token
for JWT ..” error
Are you able to access the Admin Console? If so, I don't see any reason
why you should get the error as above.
SyncopeClientFactoryBean clientFactory = new SyncopeClientFactoryBean()
.setAddress("http://localhost:9080/syncope/rest").setDomain("Master")
.setContentType(SyncopeClientFactoryBean.ContentType.JSON).setUseCompression(true);
SyncopeClient client = clientFactory.create("admin", "password");
UserService userService = client.getService(UserService.class);
UserTO userTO = userService.read("b4662c3c-3a7c-490c-a62c-3c3a7ca90c62");
Otherwise what will be the rest api to use for retrieving user data?
I'd suggest you to take a look at the Swagger UI, available under
/syncope/swagger/ if you have enabled it, under
Users > GET /users/{key}
Please note the "key" parameter description: "if value looks like a UUID
then it is interpreted as key, otherwise as a (user)name".
An example can be found at
http://syncope-vm.apache.org:9080/syncope/swagger/
HTH
Regards.
--
Francesco Chicchiriccò
Tirasa - Open Source Excellence
http://www.tirasa.net/
Member at The Apache Software Foundation
Syncope, Cocoon, Olingo, CXF, OpenJPA, PonyMail
http://home.apache.org/~ilgrosso/