Starting with recent SNAPSHOTs releases of 1.2.0, it has become fairly easy to call Apache Syncope via REST from your Java application.

Starting with recent SNAPSHOTs releases of 1.2.0, it has become fairly easy to call Apache Syncope via REST from your Java application.

Basically, all you need is to obtain a SyncopeClient instance via the following statement in order to set the base REST URL and credentials:

SyncopeClient client = new SyncopeClientFactoryBean().
              setAddress("http://localhost:9080/syncope/rest/").
              create("username", "password");

and you get enabled for any kind of REST service interaction with Apache Syncope; for example (retrieving an user given his username):

UserTO anyUser = client.getService(UserService.class).read("anyUser");

There are of course many other options to customize the client configuration, including the content-type to be used for data exchange, JSON (default) or XML.

The only Maven dependency needed is:

<dependency>
  <groupId>org.apache.syncope</groupId>
  <artifactId>syncope-client</artifactId>
  <version>1.2.0-SNAPSHOT</version>
</dependency>

Remarks

  • There is a complete sample at GitHub: just compare the complexity between branches SYNCOPE-1_1_X (for Apache Syncope 1.1.X) and master (for Apache Syncope 1.2.0)
  • Waiting for a proper self-updating REST documentation, please refer to
    1. this wiki page
    2. these javadocs
    for a documented list of available REST services in Apache Syncope.

Enjoy!

1 VOTIYes, Excellent!Yes, Excellent!
Ti è stato utile questo articolo?
Dal Blog di Tirasa
Quello che facciamo, studiamo e pensiamo tutti i giorni lo condividiamo qui.
Vai al blog >