CycleResource class
Bases: Resource
Single object resource
get:
tags:
- api
description: |
Returns a CycleSchema
representing the unique Cycle
identified by the cycle_id
given as parameter. If no cycle corresponds to cycle_id, a 404
error is returned.
!!! Example
=== "Curl"
```shell
curl -X GET http://localhost:5000/api/v1/cycles/CYCLE_223894_e0fab919-b50b-4b9f-ac09-52f77474fa7a
```
In this example the REST API is served on port 5000 on localhost. We are using curl command line
client.
`CYCLE_223894_e0fab919-b50b-4b9f-ac09-52f77474fa7a` is the value of the *cycle_id* parameter. It
represents the identifier of the Cycle we want to retrieve.
In case of success here is an example of the response:
``` JSON
{"cycle": {
"frequency": "Frequency.DAILY",
"creation_date": "2022-08-04T17:13:32.797384",
"id": "CYCLE_223894_e0fab919-b50b-4b9f-ac09-52f77474fa7a",
"start_date": "2022-08-04T00:00:00",
"end_date": "2022-08-04T23:59:59.999999",
"name": "Frequency.DAILY_2022-08-04T17:13:32.797384"
```
In case of failure here is an example of the response:
``` JSON
{"message": "Cycle CYCLE_223894_e0fab919-b50b-4b9f-ac09-52f77474fa7a 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/cycles/CYCLE_223894_e019-b50b-4b9f-ac09-527a")
print(response)
print(response.json())
```
`CYCLE_223894_e0fab919-b50b-4b9f-ac09-52f77474fa7a` is the value of the *cycle_id* parameter. It
represents the identifier of the Cycle we want to retrieve.
In case of success here is an output example:
```
<Response [200]>
{'cycle': {
'frequency': 'Frequency.DAILY',
'creation_date': '2022-08-04T17:13:32.797384',
'id': 'CYCLE_223894_e0fab919-b50b-4b9f-ac09-52f77474fa7a',
'start_date': '2022-08-04T00:00:00',
'end_date': '2022-08-04T23:59:59.999999',
'name': 'Frequency.DAILY_2022-08-04T17:13:32.797384'
```
In case of failure here is an output example:
```
<Response [404]>
{'message': 'Cycle CYCLE_223894_e0fab919-b50b-4b9f-ac09-52f77474fa7a 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: cycle_id
schema:
type: string
description: The identifier of the cycle to retrieve.
responses:
200:
content:
application/json:
schema:
type: object
properties:
cycle: CycleSchema
404:
description: No cycle has the cycle_id identifier.
delete:
tags:
- api
description: |
Deletes the Cycle
identified by the cycle_id given as parameter. If the cycle does not exist,
a 404 error is returned.
!!! Example
=== "Curl"
```shell
curl -X DELETE http://localhost:5000/api/v1/cycles/CYCLE_223894_e0fab919-b50b-4b9f-ac09-52f77474fa7a
```
In this example the REST API is served on port 5000 on localhost. We are using curl command line
client.
`CYCLE_223894_e0fab919-b50b-4b9f-ac09-52f77474fa7a` is the value of the *cycle_id* parameter. It
represents the identifier of the Cycle we want to delete.
In case of success here is an example of the response:
``` JSON
{"message": "Cycle CYCLE_223894_e0fab919-b50b-4b9f-ac09-52f77474fa7a was deleted."}
```
In case of failure here is an example of the response:
``` JSON
{"message": "Cycle CYCLE_223894_e0fab919-b50b-4b9f-ac09-52f77474fa7a 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/cycles/CYCLE_794_ef21-af91-4f41-b6e8-7648eda")
print(response)
print(response.json())
```
`CYCLE_223894_e0fab919-b50b-4b9f-ac09-52f77474fa7a` is the value of the *cycle_id* parameter. It
represents the identifier of the Cycle we want to delete.
In case of success here is an output example:
```
<Response [200]>
{"message": "Cycle CYCLE_223894_e0fab919-b50b-4b9f-ac09-52f77474fa7a was deleted."}
```
In case of failure here is an output example:
```
<Response [404]>
{'message': 'Cycle CYCLE_223894_e0fab919-b50b-4b9f-ac09-52f77474fa7a 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: cycle_id schema: type: string description: The id of the cycle to delete. responses: 200: content: application/json: schema: type: object properties: message: type: string description: Status message. 404: description: No cycle has the cycle_id identifier.