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, import them to REST API Tools or by accessing the Swagger UI.
- 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.
- From Cloudera Manager:
- Go to your cluster in Cloudera Manager.
- Select SQL Stream Builder from the list of services.
- Click Web UI.
- Select SQLStreamBuilder API Explorer.
- From Streaming SQL Console:
- Access Streaming SQL Console.
- Click API Explorer from the main menu.
You can use the SSB REST API with Command Line Interface (CLI), you can
also import the REST API swagger.json
file to a REST API Tool, for example
Postman, and you also have the option to use the REST API with the Swagger User Interface
(UI).
- 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 Streaming SQL Engine hostname, port and the
required operation for the endpoint. 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 and unsecured GET method to list the SQL jobs:
$ curl -H 'Username: <your_username>' \
'https://<cluster_domain>:<streaming_sql_engine_server_port>/api/v1/ssb/jobs'
$ kinit <your_user>
$ curl -ik --negotiate -u: \
'https://<cluster_domain>:<streaming_sql_engine_server_port>/api/v1/ssb/jobs'
$ curl -ik --negotiate -u <knox_username>:<knox_password> \
'https://<cluster_domain>:<streaming_sql_engine-server_port>/gateway/cdp-proxy-api/ssb-sse-api/api/v1/ssb/jobs'
Using REST API Tool
When using REST API Tools, you need to connect to the cluster that
hosts the SQL Stream Builder REST API. You can also use the following URL in a browser to
download the swagger.json
file when you need to manually upload the REST API
endpoints for a Tool.
http(s)://<cluster-domain>:<streaming-sql-engine-server-port>/swagger/api-docs/public
Using Swagger UI
You can access the Swagger UI to use the SSB REST API by adding your hostname and the Streaming SQL Engine port to the Swagger UI URL.
http(s)://<cluster-domain>:<streaming-sql-engine-server-port>/swagger-ui/index.html?configUrl=/swagger/api-docs/swagger-config
You can also download the swagger.json
for the SSB REST API using the Swagger
UI.