README optimserver-client-api 2.1


Maven users

Add this dependency to your project’s POM:


Gradle users

Add this dependency to your project’s build file:

compile "com.decisionbrain:optimserver-client-api:3.2.1-RC1"
compile "org.keycloak:keycloak-authz-client:4.6.0.Final"

Getting Started

Please follow the installation instruction and execute the following Java code:


import java.util.*;
import org.apache.http.impl.client.HttpClients;
import org.keycloak.authorization.client.AuthzClient;
import org.keycloak.authorization.client.Configuration;

public class BucketApiExample {

    private static final String API_URL = "https://OPTIMSERVER/";
    private static final String KEYCLOAK_URL = "https://OPTIMSERVER_AUTHENTICATION/auth";
    private static final String KEYCLOAK_REALM = "decisionbrain";
    private static final String KEYCLOAK_CLIENT = "optimserver";
    private static final String KEYCLOAK_USER = "optimserver";
    private static final String KEYCLOAK_PASSWORD = "optimserver";

    public static void main(String[] args) {
        ApiClient apiClient = new ApiClient()
                .addDefaultHeader("Authorization", "Bearer " + getToken());

        BucketApi apiInstance = new BucketApi(apiClient);
        BucketCreation bucketCreation = new BucketCreation(); // BucketCreation | 
        try {
            BucketDefinition result = apiInstance.createBucket(bucketCreation);
        } catch (ApiException e) {
            System.err.println("Exception when calling BucketApi#createBucket");

    private static String getToken() {
        final Configuration configuration = new Configuration(KEYCLOAK_URL, KEYCLOAK_REALM, KEYCLOAK_CLIENT, Collections.singletonMap("secret", ""), HttpClients.createDefault());

        try {
            return AuthzClient.create(configuration).obtainAccessToken(KEYCLOAK_USER, KEYCLOAK_PASSWORD).getToken();
        } catch (Exception e) {
            throw new IllegalArgumentException("Token can't be obtained", e);

Documentation for API Endpoints

All URIs are relative to https://dbos-master-host

Class Method HTTP request Description
BucketApi createBucket POST /buckets Creates a new Bucket, and returns its ID for later use.
BucketApi deleteBucket DELETE /buckets/{bucketId} Deletes this bucket.
BucketApi getBucket GET /buckets/{bucketId} Return a bucket object.
BucketApi getBucketContent GET /buckets/{bucketId}/content Returns the content of the requested bucket.
BucketApi getBucketDefinition GET /buckets/{bucketId}/definition Return a bucket definition object.
BucketApi getBuckets GET /buckets Returns requested bucket definitions.
BucketApi getBucketsContent GET /buckets/content Returns an archive containing the compressed content of requested buckets.
ConfigurationApi refreshOnDemandTasks PUT /configuration/on-demand/tasks/refresh Refresh on demand tasks
FileApi saveTemporaryFile POST /files Creates a temporary file on server side for later use.
FlowApi createFlow POST /jobFlows Creates a new Flow, and returns its ID for later use.
FlowApi getJobDefinitionsByFlow GET /jobFlows/{flowId}/jobs Returns job definitions for the given flow ID.
FlowApi getJobFlow GET /jobFlows/{flowId} Returns a Flow with the given ID, if any.
FlowApi getJobFlows GET /jobFlows Returns all known flows.
JobApi createJob POST /jobs Creates a new asyncron Job (without starting it), and returns its ID for later use.
JobApi deleteJob DELETE /jobs/{jobId} Deletes this job and cleans all related data.
JobApi getJobDefinition GET /jobs/{jobId} Returns a job definition.
JobApi getJobs GET /jobs Returns all current job definitions.
JobExecutionApi getJobExecutionStatus GET /jobs/{jobId}/execution Gets the job execution status.
JobExecutionApi startAsyncJobExecution POST /jobs/{jobId}/execution Schedule an already created job for an asyncronous execution.
JobExecutionApi startSyncJobExecution POST /jobs/execution Schedule a syncron job execution.
JobExecutionApi stopJobExecution DELETE /jobs/{jobId}/execution Request this job to stop its execution.
ProjectInformationApi getProject GET /project Gets the project information.
TaskApi getTask GET /tasks/{taskId} Get a specific task details.
TaskApi getTasks GET /tasks Get all known tasks.
TaskExecutionApi getTaskExecution GET /tasks/{taskId}/execution Gets all the jobs execution status for this task.

Documentation for Models

Documentation for Authorization

Authentication schemes defined for the API:


  • Type: HTTP basic authentication


  • Type: HTTP basic authentication


It’s recommended to create an instance of ApiClient per thread in a multithreaded environment to avoid any potential issues.