Using SQL Stream Builder REST API

You can use the REST API to monitor, manage and configure the SQL Stream jobs with GET, POST and DELETE HTTP methods. You can use the SQL Stream Builder (SSB) REST API in command line or use a REST API Tool.

The following HTTP methods are available for SSB:
  • GET to query information about the specified endpoint
  • POST to create resources for the specified endpoint
  • DELETE to remove objects from the specified endpoint

The REST API Reference document contains the available endpoints for SQL Stream Builder.

You can also reach the SSB REST API reference document from the following places:
  • From Cloudera Manager:
    1. Navigate to Management Console > Environments, and select the environment where you have created your cluster.
    2. Select the Streaming Analytics cluster from the list of Data Hub clusters.
    3. Select Cloudera Manager from the services.

      You are redirected to the Cloudera Manager user interface.

    4. Select SQL Stream Builder from the list of services.
    5. Click Web UI.
    6. Select SQLStreamBuilder API Explorer.
  • From Streaming SQL Console:
    1. Access Streaming SQL Console.
    2. Click API Explorer from the main menu.

You can use the SSB REST API with Command Line Interface (CLI), but you can also use a REST API Tool, for example Postman.

The Streaming SQL Engine API details the following operations for SQL Stream Builder and Flink:
  • SQL Operations: You can execute and analyze the SQL queries
  • Session Operations: You can manage and reset the SSB session
  • Sampling Operations: You can configure the sampling behavior and retrieve sampling results.
  • Job Operations: You can create and stop jobs, and also retrieve job information
  • Flink Session Cluster Operations: You can manage and reset the Flink session
  • Flink Job Management: You can run flink applications
  • Artifact Management: You can add and delete jar files and configuration files, and also retrieve information about them

Using REST API with CLI

When using the SSB REST API with CLI Tool, you need to create the POST or GET commands with curl, and also include the Manager host FQDN of the Data Hub cluster, the name of the Data Hub cluster, and the required operation for the endpoint. If necessary, you can include the Streaming SQL Engine port. The submitted commands return the information, or complete the process you have requested and display the status in the CLI.

The following examples show a secured GET method to list the SQL jobs:
curl -ik -u '<workload_username>:<workload_password>' \
   	'https://<dh_cluster_manager_host_fqdn>/<dh_cluster_name>/cdp-proxy-api/ssb-sse-api/api/v1/ssb/jobs'

Using REST API Tool

When using REST API Tools, make sure that the base URL in the HTTP request is similar to the following example:
https://<dh_cluster_manager_host_fqdn>/<dh_cluster_name>/cdp-proxy-api/ssb-sse-api/
The base path has to be the same for all endpoints. In terms of authentication, make sure you set “Basic Auth”, and use your workload username and password as credentials.