ScenarioResource class
Bases: Resource
Single object resource
get:
tags:
- api
description: |
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"
```shell
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:
``` JSON
{"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:
``` JSON
{"message": "SCENARIO_63cb358d-5834-4d73-84e4-a6343df5e08c not found."}
```
=== "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/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:
200:
content:
application/json:
schema:
type: object
properties:
scenario: ScenarioSchema
404:
description: No scenario has the scenario_id identifier.
delete:
tags:
- api
description: |
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"
```shell
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:
``` JSON
{"msg": "Scenario SCENARIO_63cb358d-5834-4d73-84e4-a6343df5e08c deleted."}
```
In case of failure here is an example of the response:
``` JSON
{"message": "Scenario SCENARIO_63cb358d-5834-4d73-84e4-a6343df5e08c not found."}
```
=== "Python"
This Python example requires the 'requests' package to be installed (`pip install requests`).
```python
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: - in: path name: scenario_id schema: type: string description: The identifier of the scenario to delete. responses: 200: content: application/json: schema: type: object properties: message: type: string description: Status message. 404: description: No scenario has the scenario_id identifier.