sdk

No menu items for this category

Java SDK

We now present a high-level Java API as a type-safe and gentle wrapper for the OpenMetadata backend.

The open-source OpenMetadata SDK for Java simplifies provisioning, managing, and using OpenMetadata resources from the Java application code.
The OpenMetadata SDK for Java libraries build on top of the underlying OpenMetadata REST API, allows you to use those APIs through familiar Java paradigms. However, you can always use the REST API directly from Java code, if you prefer to do so.

You can find the source code for the OpenMetadata libraries in the GitHub repository. As an open-source project, contributions are always welcome!

You can add the below Maven Dependency for OpenMetadata Java Client.

To create OpenMetadata Gateway, you will need to establish a connection with OpenMetadata Server. The following inputs will be needed for the same.

  • Host Port: The url on which your instance of OpenMetadata is up and running.
  • ApiVersion: The value will be "v1".
  • Auth Provider: Provide the auth provider with which you need to configure.
  • Security Config: Provide the config for the selected auth provider.

Once the connection details are provided, you can create an OpenMetadata Gateway using the following piece of code.

To use Java Client without any authentication, you can use NoOpAuthenticationProvider.java. \

Establish the OpenMetadata Server Connection and provide noOpAuthenticationProvider in the config.

The OpenMetadata Java SDK supports several auth providers:

Apart from the above mentioned auth providers, OpenMetadata Java SDK also supports Custom OIDC.

To set up Google as the auth provider, the following details are required:

Provide the Google config while creating the server connection.

To set up Okta as the auth provider, the following details should be provided:

  • Client ID: Provide the client ID for the service application
  • Org URL: It is the same as the ISSUER_URL with v1/token. It is recommended to use a separate authorization server for different applications, rather than using the default authorization server.
  • Private Key: Use the Public/Private Key Pair that was generated while Creating the Service Application. When copy-pasting the keys ensure that there are no additional codes and that it is a JSON compatible string.
  • Email: Enter the email address
  • Scopes: Add the details of the scope created in the Authorization Server. Enter the name of the default scope created.

Provide the Okta config while creating the server connection.

To set up Auth0 as the auth provider, the following details are required:

  • Client ID: Provide the client ID for the service application
  • Secret Key: Provide the client secret.
  • Domain: Provide the Auth0 domain. For example test.us.auth0.com

Provide the Auth0 config while creating the server connection.

To set up Azure as the auth provider, the following details should be provided:

  • Client ID: The Application (Client) ID is displayed in the Overview section of the registered application.
  • Client Secret: The clientSecret can be accessed from the Certificates & secret section of the application.
  • Authority: When passing the details for authority, the Tenant ID is added to the URL as: https://login.microsoftonline.com/TenantID
  • Scopes: Add the details of the scope created.

Provide the Auth0 config while creating the server connection.

To set up OpenMetadata as the auth provider, the following details should be provided:

  • JWT Token: Provide the JWT Token. For example eyJraWQiOiJHYjM4OWEtOWY3Ni1nZGpzLWE5Mmo....XN0aW9uLWJvdEBvcGVubWV0YWRhdGEub3JnIn0.Ku_FHGIS3Id3ARusMaXZDYKcq...Ztap9KDU7nZilNT2Bq-o75aIsgKKmtSuVdBTzpFK8aLGLmRp_8J007t-kpcjIW7Qf0l4...dGb0QqhoZin0JA

Provide the OpenMetadata config while creating the server connection.

To set up Custom auth provider. The following details are required:

  • Client ID: Provide the client ID of the preferred auth provider
  • Client Secret: Provide the client secret of your preferred auth provider
  • Token Endpoint: Provide the token endpoint of your preferred auth provider

Provide the custom auth provider config while creating the server connection.

You can use an API from the OpenMetadata Gateway. Using OpenMetadata Gateway, you will need to build the client by providing the class of the respected API. Below are some examples:

Please refer to the examples to access an API:

  • Tables API
  • Location API
  • Elastic Search API

If you want more examples of using different Java SDK methods, you will find them in our demo repository here.