eKuiper REST api allows you to manage external services, such as registering, deleting and listing services, listing external functions.
Register external services
This API accepts JSON content to create new external services.
POST http://localhost:9081/services
An example of a request for a file on an HTTP server:
{
"name":"random",
"file":"http://127.0.0.1/services/sample.zip"
}
An example of a request for a file on the eKuiper server:
{
"name":"random",
"file":"file:///var/services/sample.zip"
}
parameter
- name: The unique name of the external service, which must be exactly the same as the json file of service definition in the zip file.
- file: URL of external service file. URL supports http, https and file modes. When using the file mode, the file must be on the machine where the eKuiper server is located. It must be a zip file, which contains the service description json file with the same name as the service and any other auxiliary files. The schema file must be in the schema folder.
Service file format
A sample zip file of the source named sample.zip
- sample.json
- Schema directory: it contains one or more schema files used by the service. For example, sample.proto.
Display external services
This API is used to display all external services defined in the server.
GET http://localhost:9081/services
Response example:
["sample","sample2"]
Describe external services
This API is used to print detailed definitions of external services.
GET http://localhost:9081/services/{name}
The path parameter name
is the name of the external service.
Delete external services
This API is used to delete external services, and all functions defined under the service will be deleted.
DELETE http://localhost:9081/services/{name}
Update external services
This API is used to update external services, and its parameters are the same as that of service registration.
PUT http://localhost:9081/services/{name}
{
"name":"random",
"file":"http://127.0.0.1/services/sample.zip"
}
Display all external functions
Each service can contain multiple functions. This API is used to display the names of all external functions that can be used in SQL.
GET http://localhost:9081/services/functions
Result example:
["func1","func2"]
Describe external functions
This API is used to display the name of the service that defines this external function.
GET http://localhost:9081/services/functions/{name}
Result example:
{
"name": "funcName",
"serviceName": "serviceName"
}