The Maven project contained in this directory of the repository provides a Java binding for the Watson Data REST APIs.
You can use a collection of Watson Data REST APIs associated with Watson Studio and Watson Knowledge Catalog to manage data-related assets and connections in analytics projects and catalogs on IBM Cloud Pak for Data.
Use the catalog and asset APIs to create catalogs to administer your assets, associate properties with those assets, and organize the users who use the assets. Assets can be notebooks or connections to files, database sources, or data assets from a connection.
Use the governance and workflows APIs to implement data policies and a business glossary that fits to your organization to control user access rights to assets and to uncover data quality and data lineage.
Use the discovery, search, and connections APIs to add and find data within your projects and catalogs.
Semi-generated by the OpenAPI Generator
- API version: 2.35.0
- Generation date: 2020-07-15T11:01:13.251978+01:00[Europe/London]
Building the API client library requires:
- Java 1.8+
- Maven
To install the API client library to your local Maven repository, simply execute:
mvn clean install
To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:
mvn clean deploy
Refer to the OSSRH Guide for more information.
Add this dependency to your project's POM:
<dependency>
<groupId>com.ibm.watson.data</groupId>
<artifactId>watson-data-api-java-client</artifactId>
<version>0.2-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
At first generate the JAR by executing:
mvn clean package
Then manually install the following JARs:
target/watson-data-api-java-client-0.2-SNAPSHOT-jar-with-dependencies.jar
Please follow the installation instruction and execute the following Java code.
Note: it is recommended to create an instance of ApiClient
per thread in a multithreaded environment to avoid any potential issues.
import com.ibm.watson.data.client.api.CatalogsApiV2;
import com.ibm.watson.data.client.model.Catalog;
import org.springframework.web.client.RestClientException;
public class CatalogsApiV2Example {
public static void main(String[] args) {
// Setup an SSL-verification-disabled (allowing self-signed certificates) client
ApiClient defaultClient = new ApiClient(false).setBasePath("https://your-cp4d-environment");
// Configure the credentials using your username and password
defaultClient.setCredentials("your-username", "your-password");
// Create an endpoint for catalog-related activities
CatalogsApiV2 apiCatalogs = new CatalogsApiV2(defaultClient);
try {
// Retrieve the default catalog, synchronously (block), and print it out
Catalog omrsCatalog = apiCatalogs.getCatalogOnOmrsOneCatalogCohort().block();
System.out.println("Default OMRS catalog: " + omrsCatalog);
} catch (ApiException e) {
System.err.println("Exception when calling CatalogsApiV2#getCatalogOnOmrsOneCatalogCohort");
e.printStackTrace();
}
}
}
Authentication schemes defined for the API:
Use the setCredentials(String,String)
method against the ApiClient
to provide your username and password.
The ApiClient will use these credentials to obtain a Bearer
token from the Cloud Pak for Data environment, and this
token will be used for all API calls.
Use the setCredentials(String)
method against the ApiClient
to provide your IBM Cloud API key.
The ApiClient will use this to obtain a Bearer
token from IBM Cloud's IAM services, and this token will be used for
all API calls.
The API endpoints are named according to when they were first available:
- Those ending with
V2
were first available in Cloud Pak for Data v2(.5), and are still available. - Those ending with
V3
were first available in Cloud Pak for Data v3, and are therefore not available in Cloud Pak for Data v2(.5) environments. - Those without any version suffix are platform management APIs, which should be available in all versions of Cloud Pak for Data.