Paths for datanode
Entry points that interact with DataNode
entities.
/api/v1/datanodes/
¶
GET¶
Returns a DataNodeSchema
list representing all existing data nodes.
Example
curl -X GET http://localhost:5000/api/v1/datanodes
Here is an example of the response:
[
{"datanode": {
"id": "DATANODE_historical_data_set_9db1b542-2e45-44e7-8a85-03ef9ead173d",
"config_id": "historical_data_set",
"scope": "<Scope.SCENARIO: 2>",
"storage_type": "csv",
"name": "Name of my historical data node",
"owner_id": "SCENARIO_my_awesome_scenario_97f3fd67-8556-4c62-9b3b-ef189a599a38",
"last_edit_date": "2022-08-10T16:03:40.855082",
"job_ids": [],
"version": "latest",
"validity_days": null,
"validity_seconds": null,
"edit_in_progress": false,
"data_node_properties": {
"path": "daily-min-temperatures.csv",
"has_header": true}
}}
]
If there is no data node, the response is an empty list as follows:
[]
This Python example requires the 'requests' package to be installed (pip install requests
).
import requests
response = requests.get("http://localhost:5000/api/v1/datanodes")
print(response)
print(response.json())
In case of success here is an output example:
<Response [200]>
[
{"datanode": {
"id": "DATANODE_historical_data_set_9db1b542-2e45-44e7-8a85-03ef9ead173d",
"config_id": "historical_data_set",
"scope": "<Scope.SCENARIO: 2>",
"storage_type": "csv",
"name": "Name of my historical data node",
"owner_id": "SCENARIO_my_awesome_scenario_97f3fd67-8556-4c62-9b3b-ef189a599a38",
"last_edit_date": "2022-08-10T16:03:40.855082",
"job_ids": [],
"version": "latest",
"validity_days": null,
"validity_seconds": null,
"edit_in_progress": false,
"data_node_properties": {
"path": "daily-min-temperatures.csv",
"has_header": true}
}}
]
If there is no data node, the response is an empty list as follows:
<Response [200]>
[]
Note
When the authorization feature is activated (available in Taipy Enterprise edition only), this endpoint
requires the TAIPY_READER
role.
Responses
-
200
Status:OK
Name Type results [ DataNodeSchema
]
POST¶
Creates a new data node from the config_id given as parameter.
Example
curl -X POST http://localhost:5000/api/v1/datanodes?config_id=historical_data_set
In this example the config_id value ("historical_data_set") is given as parameter directly in the
url. A corresponding DataNodeConfig
must exist and must have been configured before.
Here is the output message example:
{"msg": "datanode created",
"datanode": {
"default_path": null,
"path": "daily-min-temperatures.csv",
"name": null,
"storage_type": "csv",
"scope": 2,
"has_header": true}
}
This Python example requires the 'requests' package to be installed (pip install requests
).
import requests
response = requests.post("http://localhost:5000/api/v1/datanodes?config_id=historical_data_set")
print(response)
print(response.json())
DataNodeConfig
must exist and must have been configured before.
Here is the output example:
<Response [201]>
{'msg': 'datanode created',
'datanode': {
'name': None,
'scope': 2,
'path': 'daily-min-temperatures.csv',
'storage_type': 'csv',
'default_path': None,
'has_header': True}}
Note
When the authorization feature is activated (available in Taipy Enterprise edition only), this endpoint
requires the TAIPY_EDITOR
role.
Parameters
Name | Type | Required | Description |
---|---|---|---|
config_id | string | Yes | The identifier of the data node configuration. |
Responses
-
201
Status:Created
Name Type datanode DataNodeSchema
message string
/api/v1/datanodes/{datanode_id}/
¶
DELETE¶
Deletes the DataNode
identified by the datanode_id given as parameter. If the data node does not exist,
a 404 error is returned.
Example
curl -X DELETE http://localhost:5000/api/v1/datanodes/DATANODE_historical_data_set_9db1b542-2e45-44e7-8a85-03ef9ead173d
DATANODE_historical_data_set_9db1b542-2e45-44e7-8a85-03ef9ead173d
is the value of the
datanode_id parameter. It represents the identifier of the data node we want to delete.
In case of success here is an example of the response:
{"msg": "datanode DATANODE_historical_data_set_9db1b542-2e45-44e7-8a85-03ef9ead173d deleted"}
In case of failure here is an example of the response:
{"message": "Data node DATANODE_historical_data_set_9db1b542-2e45-44e7-8a85-03ef9ead173d not found."}
This Python example requires the 'requests' package to be installed (pip install requests
).
import requests
response = requests.delete(
"http://localhost:5000/api/v1/datanodes/DATANODE_historical_data_set_9db1b542-2e45-44e7-8a85-03ef9ead173d"
)
print(response)
print(response.json())
DATANODE_historical_data_set_9db1b542-2e45-44e7-8a85-03ef9ead173d
is the value of the
datanode_id parameter. It represents the identifier of the Cycle we want to delete.
In case of success here is an output example:
<Response [200]>
{"msg": "Data node DATANODE_historical_data_set_9db1b542-2e45-44e7-8a85-03ef9ead173d deleted."}
In case of failure here is an output example:
<Response [404]>
{'message': 'Data node DATANODE_historical_data_set_9db1b542-2e45-44e7-8a85-03ef9ead173d not found.'}
Note
When the authorization feature is activated (available in Taipy Enterprise edition only), this endpoint
requires the TAIPY_EDITOR
role.
Parameters
Name | Type | Required | Description |
---|---|---|---|
datanode_id | string | Yes | The identifier of the data node to delete. |
Responses
-
200
Status:OK
Name Type message string -
404
Status:Not Found
No data node has the datanode_id identifier.
GET¶
Returns a DataNodeSchema
representing the unique DataNode
identified by the datanode_id
given as parameter. If no data node corresponds to datanode_id, a 404
error is returned.
Example
curl -X GET http://localhost:5000/api/v1/datanodes/DATANODE_hist_cfg_75750ed8-4e09-4e00-958d
-e352ee426cc9
DATANODE_hist_cfg_75750ed8-4e09-4e00-958d-e352ee426cc9
is the value of the datanode_id parameter. It
represents the identifier of the data node we want to retrieve.
In case of success here is an example of the response:
{"datanode": {
"id": "DATANODE_historical_data_set_9db1b542-2e45-44e7-8a85-03ef9ead173d",
"config_id": "historical_data_set",
"scope": "<Scope.SCENARIO: 2>",
"storage_type": "csv",
"name": "Name of my historical data node",
"owner_id": "SCENARIO_my_awesome_scenario_97f3fd67-8556-4c62-9b3b-ef189a599a38",
"last_edit_date": "2022-08-10T16:03:40.855082",
"job_ids": [],
"version": "latest",
"validity_days": null,
"validity_seconds": null,
"edit_in_progress": false,
"data_node_properties": {
"path": "daily-min-temperatures.csv",
"has_header": true}
}}
In case of failure here is an example of the response:
{"message":"DataNode DATANODE_historical_data_set_9db1b542-2e45-44e7-8a85-03ef9ead173d not found"}
This Python example requires the 'requests' package to be installed (pip install requests
).
import requests
response = requests.get(
"http://localhost:5000/api/v1/datanodes/DATANODE_historical_data_set_9db1b542-2e45-44e7-8a85-03ef9ead173d"
)
print(response)
print(response.json())
DATANODE_hist_cfg_75750ed8-4e09-4e00-958d-e352ee426cc9
is the value of the datanode_id parameter. It
represents the identifier of the data node we want to retrieve.
In case of success here is an output example:
<Response [200]>
{"datanode": {
"id": "DATANODE_historical_data_set_9db1b542-2e45-44e7-8a85-03ef9ead173d",
"config_id": "historical_data_set",
"scope": "<Scope.SCENARIO: 2>",
"storage_type": "csv",
"name": "Name of my historical data node",
"owner_id": "SCENARIO_my_awesome_scenario_97f3fd67-8556-4c62-9b3b-ef189a599a38",
"last_edit_date": "2022-08-10T16:03:40.855082",
"job_ids": [],
"version": "latest",
"validity_days": null,
"validity_seconds": null,
"edit_in_progress": false,
"data_node_properties": {
"path": "daily-min-temperatures.csv",
"has_header": true}
}}
In case of failure here is an output example:
<Response [404]>
{"message":"DataNode DATANODE_historical_data_set_9db1b542-2e45-44e7-8a85-03ef9ead173d not found"}
Note
When the authorization feature is activated (available in Taipy Enterprise edition only), this endpoint
requires the TAIPY_READER
role.
Parameters
Name | Type | Required | Description |
---|---|---|---|
datanode_id | string | Yes | The identifier of the data node to retrieve. |
Responses
-
200
Status:OK
Name Type datanode DataNodeSchema
-
404
Status:Not Found
No data node has the datanode_id identifier.
/api/v1/datanodes/{datanode_id}/read/
¶
GET¶
Returns the data read from the data node identified by datanode_id. If the data node does not exist, a 404 error is returned.
Example
curl -X GET http://localhost:5000/api/v1/datanodes/DATANODE_historical_data_set_9db1b542-2e45-44e7-8a85-03ef9ead173d/read
DATANODE_historical_data_set_9db1b542-2e45-44e7-8a85-03ef9ead173d
is the datanode_id
parameter. It represents the identifier of the data node to read.
Here is an output example. In this case, the storage type of the data node to read is csv
,
and no exposed type is specified. The data is exposed as a list of dictionaries, each dictionary
representing a raw of the csv file.
{"data": [
{"Date": "1981-01-01", "Temp": 20.7}, {"Date": "1981-01-02", "Temp": 17.9},
{"Date": "1981-01-03", "Temp": 18.8}, {"Date": "1981-01-04", "Temp": 14.6},
{"Date": "1981-01-05", "Temp": 15.8}, {"Date": "1981-01-06", "Temp": 15.8},
{"Date": "1981-01-07", "Temp": 15.8}
]}
This Python example requires the 'requests' package to be installed (pip install requests
).
import requests
response = requests.get(
"http://localhost:5000/api/v1/datanodes/DATANODE_historical_data_set_9db1b542-2e45-44e7-8a85-03ef9ead173d/read")
print(response)
print(response.json())
DATANODE_historical_data_set_9db1b542-2e45-44e7-8a85-03ef9ead173d
is the datanode_id
parameter. It represents the identifier of the data node to read.
Here is an output example. In this case, the storage type of the data node to read is csv
,
and no exposed type is specified. The data is exposed as a list of dictionaries, each dictionary
representing a raw of the csv file.
{"data": [
{"Date": "1981-01-01", "Temp": 20.7}, {"Date": "1981-01-02", "Temp": 17.9},
{"Date": "1981-01-03", "Temp": 18.8}, {"Date": "1981-01-04", "Temp": 14.6},
{"Date": "1981-01-05", "Temp": 15.8}, {"Date": "1981-01-06", "Temp": 15.8},
{"Date": "1981-01-07", "Temp": 15.8}
]}
Note
When the authorization feature is activated (available in Taipy Enterprise edition only), this endpoint
requires the TAIPY_READER
role.
Parameters
Name | Type | Required | Description |
---|---|---|---|
datanode_id | string | Yes | The id of the data node to read. |
Request body:
DataNodeFilterResponses
-
200
Status:OK
Name Type data Any -
404
Status:Not Found
No data node has the datanode_id identifier.
/api/v1/datanodes/{datanode_id}/write/
¶
PUT¶
Write data from request body into a data node by datanode_id. If the data node does not exist, a 404 error is returned.
Note
When the authorization feature is activated (available in the Enterprise edition only), this endpoint
requires TAIPY_EDITOR
role.
Code example:
curl -X PUT -d '[{"path": "/abc", "type": 1}, {"path": "/def", "type": 2}]' \
-H 'Content-Type: application/json' \
http://localhost:5000/api/v1/datanodes/DATANODE_my_config_75750ed8-4e09-4e00-958d-e352ee426cc9/write
Parameters
Name | Type | Required | Description |
---|---|---|---|
datanode_id | string | Yes | - |