SC

Java library

TM1 Java client

The IBM Planning Analytics (TM1) REST API, for Java

Every endpoint of the TM1 REST API as a typed, reactive service: cubes, dimensions, cellsets, processes, security and the server itself. Its model is generated from TM1’s own metadata, so it covers what your server can do, and its documentation says where TM1 behaves in surprising ways.

API docs Source on GitHub

Pre-release. TM1 Java client isn’t on Maven Central yet. The API docs track the latest code on master, and the version shown in them is a snapshot. To try it before the first release, build it from source.

  1. Have a TM1 server to talk to. To run one on your own computer, follow Run Planning Analytics on your own computer. You need your own licensed copy of TM1 Server.

  2. Add the client to your build. It needs Java 17 or later.

    Gradle (Kotlin)
    implementation("io.skipcheck:tm1-client:<version>")
  3. Say hello. This connects, prints the server’s version and lists its cubes:

    Java
    public static void main(String[] args) {
        Tm1Client tm1 = Tm1Client.builder()
            .baseUrl("http://localhost:8010/api/v1/")
            .basicAuth("admin", "") // tm1-server's default login
            .build();
    
        tm1.session()
            .version()
            .doOnNext(version -> System.out.println("Hello from TM1 " + version))
            .thenMany(tm1.cubes().modelCubes(ODataQuery.none().select(Cube.NAME)))
            .doOnNext(cube -> System.out.println("  " + cube.name()))
            .then(tm1.close())
            .block(); // fine in a main(); in an application, return the Mono instead
    }

Next: the API docs, where every service shows how to use it.

  • A service for each area of TM1: dimensions, hierarchies, elements and subsets; cubes, views and rules; cellsets, cell writes, sandboxes and drillthrough; processes, chores and debugging; users, groups, sessions and threads; server configuration and logs.
  • Reactive: built on Spring WebFlux and Project Reactor. Large results stream instead of loading at once.
  • Typed: a model generated from TM1’s $metadata, with typed queries and filters.
  • TM1’s surprises, documented: where TM1 ignores, refuses or reinterprets a request, the method’s documentation says so, and a test against a real server pins it.
  • Logins: TM1 security and Cognos (CAM), with session pooling and impersonation.