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.
<dependencyManagement>
<dependencies>
<dependency>
<groupId>nl.vpro.poms</groupId>
<artifactId>poms-bom</artifactId>
<version>8.3.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
...
<dependencies>
<dependency>
<groupId>nl.vpro.poms.api-clients</groupId>
<artifactId>frontend-api-client</artifactId>
</dependency>
<dependency>
<groupId>nl.vpro.poms.api-clients</groupId>
<artifactId>media-backend-api-client</artifactId>
</dependency>
<dependency>
<groupId>nl.vpro.poms.api-clients</groupId>
<artifactId>pages-backend-api-client</artifactId>
</dependency>
<dependency>
<groupId>nl.vpro.poms.api-clients</groupId>
<artifactId>client-extras</artifactId>
</dependency>
</dependencies>
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());
});
}
try (var client = MediaRestClient.configured(Env.PROD).build()) {
MediaObject mediaObject = client.getFull("WO_VPRO_025678");
log.info("{}", mediaObject);
}
There are also 'providers' available to configure them easily via spring XML’s or for example XML’s of magnolia CMS (which uses guice)
Version | java |
---|---|
>= 8.x |
jakarta.*, java 17 |
7.11 branch |
support for javax will be from here. |
>= 7.5.x |
java 17 |
7.4.x |
java 11 |