Skip to content

Paths for scenario

Entry points that interact with Scenario entities.

/api/v1/scenarios/

GET

Returns a ScenarioSchema list representing all existing Scenarios.

Example

    curl -X GET http://localhost:5000/api/v1/scenarios
In this example the REST API is served on port 5000 on localhost. We are using curl command line client.

Here is an example of the response:

[{
    "cycle": "CYCLE_863418_fdd1499a-8925-4540-93fd-9dbfb4f0846d",
    "id": "SCENARIO_63cb358d-5834-4d73-84e4-a6343df5e08c",
    "properties": {},
    "tags": [],
    "version": "latest",
    "sequences": [
        "SEQUENCE_mean_baseline_5af317c9-34df-48b4-8a8a-bf4007e1de99",
        "SEQUENCE_arima_90aef6b9-8922-4a0c-b625-b2c6f3d19fa4"],
    "subscribers": [],
    "creation_date": "2022-08-15T19:21:01.871587",
    "primary_scenario": true
    }
]

If there is no scenario, 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/scenarios")
print(response)
print(response.json())

In case of success here is an output example:

<Response [200]>
[{
    "cycle": "CYCLE_863418_fdd1499a-8925-4540-93fd-9dbfb4f0846d",
    "id": "SCENARIO_63cb358d-5834-4d73-84e4-a6343df5e08c",
    "properties": {},
    "tags": [],
    "version": "latest",
    "sequences": [
        "SEQUENCE_mean_baseline_5af317c9-34df-48b4-8a8a-bf4007e1de99",
        "SEQUENCE_arima_90aef6b9-8922-4a0c-b625-b2c6f3d19fa4"],
    "subscribers": [],
    "creation_date": "2022-08-15T19:21:01.871587",
    "primary_scenario": true
    }
]

If there is no scenario, 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

POST

Creates a new scenario from the config_id. If the config does not exist, a 404 error is returned.

Example

    curl -X POST http://localhost:5000/api/v1/scenarios?config_id=my_scenario_config
In this example the REST API is served on port 5000 on localhost. We are using curl command line client.

In this example the config_id value ("my_scenario_config") is given as parameter directly in the url. A corresponding ScenarioConfig must exist and must have been configured before.

Here is the output message example:

{"msg": "scenario created.",
"scenario": {
    "cycle": "CYCLE_863418_fdd1499a-8925-4540-93fd-9dbfb4f0846d",
    "id": "SCENARIO_63cb358d-5834-4d73-84e4-a6343df5e08c",
    "properties": {},
    "tags": [],
    "version": "latest",
    "sequences": [
        "SEQUENCE_mean_baseline_5af317c9-34df-48b4-8a8a-bf4007e1de99",
        "SEQUENCE_arima_90aef6b9-8922-4a0c-b625-b2c6f3d19fa4"],
    "subscribers": [],
    "creation_date": "2022-08-15T19:21:01.871587",
    "primary_scenario": true}
}

This Python example requires the 'requests' package to be installed (pip install requests).

import requests
response = requests.post("http://localhost:5000/api/v1/scenarios?config_id=my_scenario_config")
print(response)
print(response.json())
In this example the config_id value ("my_scenario_config") is given as parameter directly in the url. A corresponding ScenarioConfig must exist and must have been configured before.

Here is the output example:

<Response [201]>
{"msg": "scenario created.",
"scenario": {
    "cycle": "CYCLE_863418_fdd1499a-8925-4540-93fd-9dbfb4f0846d",
    "id": "SCENARIO_63cb358d-5834-4d73-84e4-a6343df5e08c",
    "properties": {},
    "tags": [],
    "version": "latest",
    "sequences": [
        "SEQUENCE_mean_baseline_5af317c9-34df-48b4-8a8a-bf4007e1de99",
        "SEQUENCE_arima_90aef6b9-8922-4a0c-b625-b2c6f3d19fa4"],
    "subscribers": [],
    "creation_date": "2022-08-15T19:21:01.871587",
    "primary_scenario": 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 scenario configuration.

Responses

/api/v1/scenarios/submit/{scenario_id}/

POST

Executes a scenario by scenario_id. If the scenario does not exist, a 404 error is returned.

Example

    curl -X POST http://localhost:5000/api/v1/scenarios/submit/SCENARIO_658d-5834-4d73-84e4-a6343df5e08c
In this example the REST API is served on port 5000 on localhost. We are using curl command line client.

SCENARIO_63cb358d-5834-4d73-84e4-a6343df5e08c is the value of the scenario_id parameter. It represents the identifier of the Scenario we want to submit.

Here is the output message example:

{"message": "Executed scenario SCENARIO_63cb358d-5834-4d73-84e4-a6343df5e08c."}

This Python example requires the 'requests' package to be installed (pip install requests).

import requests
response = requests.post(
    "http://localhost:5000/api/v1/scenarios/submit/SCENARIO_63cb358d-5834-4d73-84e4-a6343df5e08c"
)
print(response)
print(response.json())
SCENARIO_63cb358d-5834-4d73-84e4-a6343df5e08c is the value of the scenario_id parameter. It represents the identifier of the Scenario we want to submit.

Here is the output example:

<Response [202]>
{"message": "Executed scenario SCENARIO_63cb358d-5834-4d73-84e4-a6343df5e08c."}

Note

When the authorization feature is activated (available in Taipy Enterprise edition only), this endpoint requires the TAIPY_EXECUTOR role.

Parameters

Name Type Required Description
scenario_id string Yes The identifier of the scenario to submit.

Responses

/api/v1/scenarios/{scenario_id}/

DELETE

Delete the Scenario scenario identified by the scenario_id given as parameter. If the scenario does not exist, a 404 error is returned.

Example

    curl -X DELETE http://localhost:5000/api/v1/scenarios/SCENARIO_63cb358d-5834-4d73-84e4-a6343df5e08c
In this example the REST API is served on port 5000 on localhost. We are using curl command line client.

SCENARIO_63cb358d-5834-4d73-84e4-a6343df5e08c is the value of the scenario_id parameter. It represents the identifier of the scenario we want to delete.

In case of success here is an example of the response:

{"msg": "Scenario SCENARIO_63cb358d-5834-4d73-84e4-a6343df5e08c deleted."}

In case of failure here is an example of the response:

{"message": "Scenario SCENARIO_63cb358d-5834-4d73-84e4-a6343df5e08c 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/scenarios/SCENARIO_63cb358d-5834-4d73-84e4-a6343df5e08c"
)
print(response)
print(response.json())
SCENARIO_63cb358d-5834-4d73-84e4-a6343df5e08c is the value of the scenario_id parameter. It represents the identifier of the Scenario we want to delete.

In case of success here is an output example:

<Response [200]>
{"msg": "Scenario SCENARIO_63cb358d-5834-4d73-84e4-a6343df5e08c deleted."}

In case of failure here is an output example:

<Response [404]>
{'message': 'Scenario SCENARIO_63cb358d-5834-4d73-84e4-a6343df5e08c 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
scenario_id string Yes The identifier of the scenario to delete.

Responses

  • 200
    Status: OK

    Name Type
    message string
  • 404
    Status: Not Found

    No scenario has the scenario_id identifier.

GET

Returns a ScenarioSchema representing the unique scenario identified by scenario_id. If no scenario corresponds to scenario_id, a 404 error is returned.

Example

    curl -X GET http://localhost:5000/api/v1/scenarios/SCENARIO_63cb358d-5834-4d73-84e4-a6343df5e08c
In this example the REST API is served on port 5000 on localhost. We are using curl command line client.

SCENARIO_63cb358d-5834-4d73-84e4-a6343df5e08c is the value of the scenario_id parameter. It represents the identifier of the Scenario we want to retrieve.

In case of success here is an example of the response:

{"scenario": {
    "cycle": "CYCLE_863418_fdd1499a-8925-4540-93fd-9dbfb4f0846d",
    "id": "SCENARIO_63cb358d-5834-4d73-84e4-a6343df5e08c",
    "properties": {},
    "tags": [],
    "version": "latest",
    "sequences": [
        "SEQUENCE_mean_baseline_5af317c9-34df-48b4-8a8a-bf4007e1de99",
        "SEQUENCE_arima_90aef6b9-8922-4a0c-b625-b2c6f3d19fa4"],
    "subscribers": [],
    "creation_date": "2022-08-15T19:21:01.871587",
    "primary_scenario": true}}

In case of failure here is an example of the response:

{"message": "SCENARIO_63cb358d-5834-4d73-84e4-a6343df5e08c 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/scenarios/SCENARIO_63cb358d-5834-4d73-84e4-a6343df5e08c"
)
print(response)
print(response.json())
SCENARIO_63cb358d-5834-4d73-84e4-a6343df5e08c is the value of the scenario_id parameter. It represents the identifier of the Cycle we want to retrieve.

In case of success here is an output example:

<Response [200]>
{"scenario": {
    "cycle": "CYCLE_863418_fdd1499a-8925-4540-93fd-9dbfb4f0846d",
    "id": "SCENARIO_63cb358d-5834-4d73-84e4-a6343df5e08c",
    "properties": {},
    "tags": [],
    "version": "latest",
    "sequences": [
        "SEQUENCE_mean_baseline_5af317c9-34df-48b4-8a8a-bf4007e1de99",
        "SEQUENCE_arima_90aef6b9-8922-4a0c-b625-b2c6f3d19fa4"],
    "subscribers": [],
    "creation_date": "2022-08-15T19:21:01.871587",
    "primary_scenario": true}}

In case of failure here is an output example:

<Response [404]>
{'message': 'Scenario SCENARIO_63cb358d-5834-4d73-84e4-a6343df5e08c not found.'}

Note

When the authorization feature is activated (available in Taipy Enterprise edition only), this endpoint requires the TAIPY_READER role.

parameters: - in: path name: scenario_id schema: type: string description: The identifier of the scenario to retrieve.

Responses