srikanth.april30 wrote
> Hi Syncope Team,
> 
> I am working on a requirement where I need to authorize a user with
> syncope database, means validate the user with the syncope database and
> send a response as authorized user or not. By using a Java Client I have
> to achieve this. My current environment is below: 
> 
> 1.) Apache Syncope-2.0.0-M2.
> 2.) MySql
> 3.) Java 1.8
> 4.) Tomcat 8
> 5.) Ubuntu Operating System.
> 
> So far I have installed Syncope-2.0.0-M2 using
> syncope-installer-2.0.0-M2-uber.jar file and able to configure MySql
> database and created two users and roles in syncope. Syncope is running at
> http://localhost:8080/syncope-console/ in my local system. So far I have
> created a Java client and was able to connect to syncope and was able to
> fetch all users.
> Using the URL "http://localhost:8080/syncope/rest/users"; I was able to
> connect to syncope from Java Client and getting a list of all users as
> response. 
> 
> But what now I need is when I am trying the URL
> http://localhost:8080/syncope/rest/users/search?_s=surname==smith 
> and search for a particular user the response is getting as below: 
> 
> 
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> <syncope:error xmlns:syncope="http://syncope.apache.org/2.0";>
> <elements>
> <element>
> NullPointerException: 
> </element>
> </elements>
> <status>
> 500
> </status>
> <type>
> Unknown
> </type>
> </syncope:error>
> Am I not using the right URL or is there is any mistake in the URL? Any
> help would be much useful for me ?
> 
> Thanks
> Srikanth

Hi Srikanth,
related to your example above, the URL should have been

http://localhost:8080/syncope/rest/users/search?fiql=surname%3D%3Dsmith

This should work.

In case you are running the query against Syncope from Java, I would suggest
to empower the Java SyncopeClient library which provides several goodies to
simplify your work.

The query above can be obtained, for example, by the following Java code

SyncopeClient syncopeClient = new SyncopeClientFactoryBean().
        setAddress("http://localhost:8080/syncope/rest/";).
        create("admin", "password");
UserService service = syncopeClient.getService(UserService.class);

service.search(new AnySearchQuery.Builder().fiql(
SyncopeClient.getUserSearchConditionBuilder().is("surname").equalTo("smith").query()).
build());

This requires the sole Maven dependency:

    <dependency>
      <groupId>org.apache.syncope.client</groupId>
      <artifactId>syncope-client-lib</artifactId>
      <version>2.0.0-M2</version>
    </dependency>

HTH
Regards.

--
View this message in context: 
http://syncope-user.1051894.n5.nabble.com/Getting-500-when-I-try-to-Authorize-an-user-from-syncope-database-tp5708417p5708423.html
Sent from the syncope-user mailing list archive at Nabble.com.

Reply via email to