Using Public APIs

The Data Hub components expose a set of Application Programming Interfaces (APIs) that can be queried using external tools. These APIs are implemented using the Java 2 Platform Enterprise Edition (J2EE) technologies and are provided as Representational State Transfer (RESTful) web services. You can access these services using clients implemented in any programming language that supports the HTTP protocol. 

The following sample code for a Java REST client explains how to write a client for a RESTful service. The code must be adapted with specific calls according to the selected API. For RESTful services (TimeForecast Model API, Search API, and Backend Control API), you must make HTTP calls using Data Access Objects (DAO).

package com.bmc.bco.dataprv.test;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CookieStore;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.protocol.HttpClientContext;
import org.apache.http.impl.client.BasicCookieStore;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;

/*** A simple example that uses HttpClient to execute an HTTP request against
* a target site that requires user authentication.

class ClientAuthentication {
public static void main(String[] args) throws Exception {
   CredentialsProvider credsProvider = new BasicCredentialsProvider();
             new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT, AuthScope.ANY_REALM),
             new UsernamePasswordCredentials("user", "passwd"));
       CloseableHttpClient httpclient = HttpClients.custom()
      try {
           HttpGet httpget = new HttpGet("http://<optconsole external address>/dh-services/<ws_name>/<ws_method>");
           HttpClientContext context = HttpClientContext.create();
           CookieStore cookieStore = new BasicCookieStore();
		System.out.println("Executing request " + httpget.getRequestLine());
        CloseableHttpResponse response = httpclient.execute(httpget, context);
         try {
           	} finally {
	} finally {

For information about the public APIs and how they can be queried using external tools, see the following topics:

Was this page helpful? Yes No Submitting... Thank you