Component
Components are the core building blocks of the Splight engine, as they are responsible for handling all data processing within the system. They come in two main forms: algorithms, which transform and analyze data, and connectors, which pass data between components. Despite their different roles, both types share the same structure and are defined in the same way. Each component includes a set of routines that are executed during runtime, enabling seamless interaction with the underlying infrastructure by sending and receiving data as needed.
Creating a Component
To create a component, you need to specify the following parameters:
component_name
The name of the component.
Yes
component_description
A description of the component.
No
component_version
The version of the component.
Yes
component_input
The inputs of the component.
Yes
component_output
The outputs of the component.
Yes
component_routine
The routines of the component.
Yes
deployment_capacity
The capacity of the component (small
, medium
, large
).
Yes
custom_types
Custom types for the component.
No
endpoints
Endpoints of the component.
No
deployment_type
The type of deployment.
Yes
tags
Tags for the component.
No
curl --request POST \
--url https://api.splight.com/v3/engine/component/algorithms/
--header 'authorization: Splight <access_id> <secret_key>' \
--header 'content-type: application/json' \
--data '{
"name": "<component_name>",
"description": "<component_description>",
"version": "<component_version>",
"deployment_capacity": "<deployment_capacity>",
"custom_types": [],
"input": [
"<component_input>"
],
"output": [
"<component_output>"
],
"routines": [
"<component_routine>"
],
"endpoints": [],
"deployment_type": "SPLIGHT_HOSTED",
"tags": []
}'
Where the input and output fields dependends on the component type.
Reading Components
The Splight API provides a comprehensive set of endpoints for reading component data. You can retrieve information about all components or filter them based on specific criteria. The API supports various query parameters to help you narrow down your search.
Let's explore some examples of how to read components using the API. Below are simple code snippets using curl and Python:
Getting all Components
curl --request GET \
--url https://api.splight.com/v3/engine/component/<component_type> \
--header 'authorization: Splight <access_id> <secret_key>' \
Where component_type
is the type of the component (e.g., "algorithm", "connector"). If you want to retrieve all components, you can omit this parameter.
Retrive a single Component
curl --request GET \
--url https://api.splight.com/v3/engine/component/<component_type>/<component_id> \
--header 'authorization: Splight <access_id> <secret_key>' \
Updating a Component
Before updating a component, ensure that it is stopped, then perform the update and restart it afterward.
curl --request PATCH \
--url https://api.splight.com/v3/engine/component/<component_type>/<component_id> \
--header 'authorization : Splight <access_id> <secret_key>' \
--header 'content-type: application/json' \
--data '{
"name": "<component_name>",
"description": "<component_description>",
"version": "<component_version>",
"deployment_capacity": "<deployment_capacity>",
"custom_types": [],
"input": [
"<component_input>"
],
"output": [
"<component_output>"
],
"routines": [
"<component_routine>"
],
"endpoints": [],
"deployment_type": "SPLIGHT_HOSTED",
"tags": []
}'
All fields are the same as in the creation process and all of them can be updated, except for the component_id
, which is required to identify the component being updated and cannot be changed.
Deleting a Component
curl --request DELETE \
--url https://api.splight.com/v3/engine/component/<component_type>/<component_id> \
--header 'authorization: Splight <access_id> <secret_key>' \
Routines
Routines are the core of the component, as they are responsible for processing data.
Creating a Routine
The routines are defined in the component and can be created with the following parameters:
routine_name
The name of the routine.
Yes
routine_description
A description of the routine.
No
component_id
The ID of the component to which the routine belongs.
Yes
routine_type
The type of the routine (e.g., "inference", "training").
Yes
routine_config
The configuration of the routine.
Yes
routine_input
The inputs of the routine.
Yes
routine_output
The outputs of the routine.
Yes
Each routine has a specific purpose and can be created using the following structure:
curl --request POST \
--url https://api.splight.com/v3/engine/component/routines/ \
--header 'authorization: Splight <access_id> <secret_key>' \
--header 'content-type: application/json' \
--data '{
"name": "<routine_name>",
"description": "<routine_description>",
"component_id": "<component_id>",
"type": "<routine_type>,
"config": [
"<routine_config>"
],
"input": [
"<routine_input>"
],
"output": [
"<routine_output>"
]
}'
Reading Routines
As the component, the routines can be read in two ways: by retrieving all routines or by retrieving a single routine using its ID.
Getting All Routines
curl --request GET \
--url https://api.splight.com/v3/engine/component/routines/?component_id=<component_id> \
--header 'authorization: Splight <access_id> <secret_key>' \
Updating a Routine
curl --request PATCH \
--url https://api.splight.com/v3/engine/component/routines/<routine_id> \
--header 'authorization: Splight <access_id> <secret_key>' \
--header 'content-type: application/json' \
--data '{
"name": "<routine_name>",
"description": "<routine_description>",
"component_id": "<component_id>",
"type": "<routine_type>",
"config": [
"<routine_config>"
],
"input": [
"<routine_input>"
],
"output": [
"<routine_output>"
]
}'
Deleting a Routine
curl --request DELETE \
--url https://api.splight.com/v3/engine/component/routines/<routine_id> \
--header 'authorization: Splight <access_id> <secret_key>' \
Last updated
Was this helpful?