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 our 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.
A generator we recommend is the openapi-generator, but there are other generators available on the internet.
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"
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", 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
Show available languages
npx @openapitools/openapi-generator-cli list
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
Show custom generator options for the chosen language
Example: "java" language
npx @openapitools/openapi-generator-cli config-help -g java
Run generator with custom options
Example: "java" language, set 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
By default, the local generator creates the client in the current directory, this can be overridden by the -o option.