Skip to content

Latest commit

 

History

History
233 lines (183 loc) · 8.43 KB

README.md

File metadata and controls

233 lines (183 loc) · 8.43 KB

LUSID_by_Finbourne

Java SDK for the FINBOURNE Workflow API

Contents

Summary

This is the java SDK for the FINBOURNE Workflow API, part of the LUSID by FINBOURNE platform. To use it you'll need a LUSID account - sign up for free at lusid.com.

Workflow provides functionality for automating the LUSID platform - see https://support.lusid.com/knowledgebase/article/KA-02181/ to learn more.

For more details on other applications in the LUSID platform, see Understanding all the applications in the LUSID platform.

This sdk supports Production, Early Access, Beta and Experimental API endpoints. For more details on API endpoint categories, see What is the LUSID feature release lifecycle. To find out which category an API endpoint falls into, see the swagger page.

This code is automatically generated by the OpenAPI Generator project.

Versions

  • API version: 0.1.1330
  • SDK version: 2.0.166

Requirements

  • Java 1.8+

Installation

Maven

Add this dependency to your pom.xml

<dependency>
    <groupId>com.finbourne</groupId>
    <artifactId>workflow-sdk</artifactId>
    <version>2.0.166</version>
</dependency>

Gradle

Add this dependency to your build.gradle

  repositories {
    mavenCentral()
  }

  dependencies {
     implementation "com.finbourne:workflow-sdk:2.0.166"
  }

Getting Started

You'll need to provide some configuration to connect to the FINBOURNE Workflow API - see the articles about short-lived access tokens and a long-lived Personal Access Token. This configuration can be provided using a secrets file or environment variables.

For some configuration it is also possible to override the global configuration at the ApiFactory level, or at the request level. For the set of configuration which can be overridden, please see ConfigurationOptions. For a code illustration of this configuration being overridden, please see the example.

Environment variables

Required for a short-lived access token

FBN_TOKEN_URL
FBN_WORKFLOW_URL
FBN_USERNAME
FBN_PASSWORD
FBN_CLIENT_ID
FBN_CLIENT_SECRET

Required for a long-lived access token

FBN_WORKFLOW_URL
FBN_ACCESS_TOKEN

You can send your requests to the FINBOURNE Workflow API via a proxy, by setting FBN_PROXY_ADDRESS. If your proxy has basic auth enabled, you must also set FBN_PROXY_USERNAME and FBN_PROXY_PASSWORD.

Other optional configuration

# sdk client timeouts in milliseconds - a value of 0 means no timeout, otherwise timeout values must be between 1 and 2147483647
# please note - the chances of seeing a network issue increases with the duration of the request
# for this reason, rather than increasing the timeout, it will be more reliable to use an alternate polling style endpoint where these exist
FBN_TOTAL_TIMEOUT_MS # the default is 1800000 (30 minutes)
FBN_CONNECT_TIMEOUT_MS # the default is 0 (no timeout)
FBN_READ_TIMEOUT_MS # the default is 0 (no timeout)
FBN_WRITE_TIMEOUT_MS # the default is 0 (no timeout)
FBN_RATE_LIMIT_RETRIES # the default is 2

Secrets file

The secrets file must be in the current working directory. By default the SDK looks for a secrets file called secrets.json

Required for a short-lived access token

{
    "api":
    {
        "tokenUrl":"<your-token-url>",
        "workflowUrl":"https://<your-domain>.lusid.com/workflow",
        "username":"<your-username>",
        "password":"<your-password>",
        "clientId":"<your-client-id>",
        "clientSecret":"<your-client-secret>",
    }
}

Required for a long-lived access token

{
    "api":
    {
        "workflowUrl":"https://<your-domain>.lusid.com/workflow",
        "accessToken":"<your-access-token>"
    }
}

You can send your requests to the FINBOURNE Workflow API via a proxy, by adding a proxy section. If your proxy has basic auth enabled, you must also supply a username and password in this section.

{
    "api":
    {
        "workflowUrl":"https://<your-domain>.lusid.com/workflow",
        "accessToken":"<your-access-token>"
    },
    "proxy":
    {
        "address":"<your-proxy-address>",
        "username":"<your-proxy-username>",
        "password":"<your-proxy-password>"
    }
}

Other optional configuration

{
    "api": 
    {
        // sdk client timeouts in milliseconds - a value of 0 means no timeout, otherwise timeout values must be between 1 and 2147483647
        // please note - the chances of seeing a network issue increases with the duration of the request
        // for this reason, rather than increasing the timeout, it will be more reliable to use an alternate polling style endpoint where these exist
        "totalTimeoutMs":"<timeout-in-ms>", // the default is 1800000 (30 minutes)
        "connectTimeoutMs":"<timeout-in-ms>", // the default is 0 (no timeout)
        "readTimeoutMs":"<timeout-in-ms>", // the default is 0 (no timeout)
        "writeTimeoutMs":"<timeout-in-ms>", // the default is 0 (no timeout)
        "rateLimitRetries":<retries-when-being-rate-limited> // the default is 2
    }
}

Example

import com.finbourne.workflow.model.*;
import com.finbourne.workflow.api.ActionLogsApi;
import com.finbourne.workflow.extensions.ApiConfigurationException;
import com.finbourne.workflow.extensions.ApiFactoryBuilder;
import com.finbourne.workflow.extensions.auth.FinbourneTokenException;

import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;

public class ActionLogsApiExample {

    public static void main(String[] args) throws FileNotFoundException, UnsupportedEncodingException, ApiConfigurationException, FinbourneTokenException {
        String fileName = "secrets.json";
        try(PrintWriter writer = new PrintWriter(fileName, "UTF-8")) {
          writer.write("{" +
            "\"api\": {" +
            "    \"tokenUrl\": \"<your-token-url>\"," +
            "    \"workflowUrl\": \"https://<your-domain>.lusid.com/workflow\"," +
            "    \"username\": \"<your-username>\"," +
            "    \"password\": \"<your-password>\"," +
            "    \"clientId\": \"<your-client-id>\"," +
            "    \"clientSecret\": \"<your-client-secret>\"" +
            "  }" +
            "}");
        }

        // uncomment the below to use configuration overrides
        // ConfigurationOptions opts = new ConfigurationOptions();
        // opts.setTotalTimeoutMs(2000);
        
        // uncomment the below to use an api factory with overrides
        // ApiFactory apiFactory = ApiFactoryBuilder.build(fileName, opts);
        // ActionLogsApi apiInstance = apiFactory.build(ActionLogsApi.class);

        ActionLogsApi apiInstance = ApiFactoryBuilder.build(fileName).build(ActionLogsApi.class);
        String id = "id_example"; // String | The Action Id
        try {
            // uncomment the below to set overrides at the request level
            // ActionLog result = apiInstance.getActionLogs(id).execute(opts);

            ActionLog result = apiInstance.getActionLogs(id).execute();
            System.out.println(result.toJson());
        } catch (ApiException e) {
            System.err.println("Exception when calling ActionLogsApi#getActionLogs");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            e.printStackTrace();
        }
    }
}

Endpoints and models