ScenarioList class

Bases: Resource

Creation and get_all


get: tags: - api summary: Get all scenarios. description: | Returns a ScenarioSchema list representing all existing Scenarios.

!!! Example

    === "Curl"
        ```shell
            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:
        ``` JSON
        [{
            "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:
        ``` JSON
        []
        ```

    === "Python"
        This Python example requires the 'requests' package to be installed (`pip install requests`).
        ```python
        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: 200: content: application/json: schema: allOf: - type: object properties: results: type: array items: $ref: '#/components/schemas/ScenarioSchema' post: tags: - api description: | Creates a new scenario from the config_id. If the config does not exist, a 404 error is returned.

!!! Example

    === "Curl"
        ```shell
            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}
        }
        ```

    === "Python"
        This Python example requires the 'requests' package to be installed (`pip install requests`).
        ```python
        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: - in: query name: config_id schema: type: string description: The identifier of the scenario configuration. responses: 201: content: application/json: schema: type: object properties: message: type: string description: Status message. scenario: ScenarioSchema