The finAPI documentation is based on OpenAPI 3 format (often also referred to as ‘Swagger’). OpenAPI is a specification for machine-readable interface files for describing, producing, consuming, and visualizing RESTful web services. A variety of tools are available to generate code, documentation and test cases given an OpenAPI interface file. You will find more information on the OpenAPI specification page.

One very useful feature of OpenAPI is the possibility to auto-generate SDKs based on the API documentation. These SDKs facilitate the implementation of our API into your project and can greatly reduce the development time to integrate finAPI. Such generators usually produce good results, but it's likely that you have to fix or adjust the code to meet your special needs.

There are a bunch of different SDK generators available on the internet, but one that we recommend is the openapi-generator. In the next sections, we explain the different options that you have to generate an SDK with the openapi-generator.

Note for Java SDK: The recent versions of the openapi-generator create non-compilable code segments in some classes. Please use the openapi-sdk-patcher tool below to patch the generated SDK. To do this, unzip the generated SDK and then run the tool against the 'model' directory. The tool will remove any non-compilable code from the model classes.

Example:
java -jar openapi-sdk-patcher.jar "C:\java-client\src\main\java\org\openapitools\client\model"

openapi-sdk-patcher.jar

Download SDK from finAPI documentation site

The easiest way to generate an SDK is directly integrated into the finAPI documentation site:

Just open https://docs.finapi.io,  select your desired API in the "SELECT PRODUCT" combo box and click on "Download SDK"

selectProduct.png

In the pop-up dialogue, select the desired target language in the combo box. For some languages, different generators are available. By clicking on "DOWNLOAD SDK" in the pop-up dialogue, your request is forwarded to http://api.openapi-generator.tech, which is the online version of the openapi-generator mentioned above.

After a few seconds, the download of a ZIP file containing the generated client will be triggered. Unpack the client and integrate it into your project.

Usually, a complete project is generated, including build files for the respective language. As we run the generator with default options, the code may not fit all your needs. The "Install SDK generator locally" approach described below is more flexible.

Install SDK generator locally

As mentioned, the online variant operates with default generator settings. But the openapi-generator project defines many options to control the generator output, depending on the chosen target language. By installing the openapi-generator locally, you are able to use these options to get better results which may reduce the need for manual changes to the generated code.

Please refer to https://openapi-generator.tech/docs/installation , for how the ways in which to install the SDK generator locally and choose the option that fits you best.

As an example, we describe the NPM option. Please make sure you have NPM and a Java Runtime environment installed.

Install the generator

npm install @openapitools/openapi-generator-cli -g
CODE

Show available languages

npx @openapitools/openapi-generator-cli list
CODE

Run generator with default options
Example: "java" language

npx @openapitools/openapi-generator-cli generate -g java -i https://sandbox.finapi.io/api-docs/openapi-access-latest.yaml
CODE

Show custom generator options for the chosen language

Example: "java" language

npx @openapitools/openapi-generator-cli config-help -g java 
CODE

Run generator with custom options
Example: "java" languageset apiPackage=io.finapi.client

npx @openapitools/openapi-generator-cli generate -g java -i https://sandbox.finapi.io/api-docs/openapi-access-latest.yaml -p apiPackage=io.finapi.client
CODE

By default, the local generator creates the client in the current directory, this can be overridden by the -o option.