Using SQL Stream Builder REST API

You can use the REST API to monitor, manage and configure the SQL Stream jobs with GET and POST 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
  • PUT to update existing resources for the specified endpoint as a whole
  • PATCH to partially update existing 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 on the main menu of Streaming SQL Console.

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:
  • Heartbeat
  • Admin Operations
  • User Operations
  • User Keytab Operations
  • Data Source Operations
  • Table Operations
  • Project Operations
  • Project Environment Operations
  • Project Sync Operations
  • Project Invitation Operations
  • Project Permission Operations
  • SQL Operations
  • SSB Session Operations
  • Job Operations
  • Sampling Operations
  • Flink Job Operations
  • Flink Session Cluster Operations
  • Artifact Operations
  • UDF Artifact Operations
  • UDF Operations
  • API Key Operations
  • Connector Operations
  • Data Format Operations
  • Diagnostic Operations

Obtaining endpoint URLs

You need to obtain the Endpoint URL of the Streaming SQL Engine API that is needed for the API calls using the following steps:
  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. Click Endpoints on the Data Hub cluster details page.
  4. Copy and note down the Streaming SQL Engine API endpoint.

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 -u: --negotiate '[***WORKLOAD_USERNAME***]:[***WORKLOAD_PASSWORD***]' \
   	'[***ENDPOINT_BASE_URL***]/api/v1/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:
[***ENDPOINT_BASE_URL***]/api/v1/jobs
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.