api-clients
Java API clients for the POMS Rest API’s (Frontend API, Backend API, Pages Publisher)
The clients are basicly generated using resteasy to proxy the actual service interface, and they are decorated with some interceptors and similar techniques to arrange the appropriate authentication, to let the generated client automaticly fill common parameters, and things like that.
We also add a common way to instantiate (using the builder pattern) and configure them.
It is split up in several modules. These are the important ones:
-
frontend-api-client
Provides clients for the NPO Frontend API -
media-backend-api-client
. Provides a client for the POMS Backend API. -
pages-backend-api-client
Provides clients for the Pages Publisher API -
client-extras
Provides some utilities which will make interaction with some calls simpler.
The clients can be configured by code and/or a configuration file in ${user.home}/conf/apiclient.properties
.
NpoApiClients clients = NpoApiClients.configured(nl.vpro.util.Env.TEST).build();
NpoApiMediaUtil util = new NpoApiMediaUtil(clients);
try(CloseableIterator<MediaObject> i = util.iterate(null, "vpro-predictions")) {
i.forEachRemaining(mediaObject -> {
log.info("{}", i.next());
});
}
There are also 'providers' available to configure them easily via spring XML’s or for example XML’s of magnolia CMS (which uses guice)
TODO
-
Document how to wire via spring xml