CycleList class
Bases: Resource
Creation and get_all
get:
tags:
- api
description: |
Returns a CycleSchema list representing all existing Cycles.
!!! Example
=== "Curl"
```shell
curl -X GET http://localhost:5000/api/v1/cycles
```
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
[
{
"frequency": "Frequency.DAILY",
"end_date": "2022-08-06T23:59:59.999999",
"creation_date": "2022-08-06T15:45:50.223894",
"start_date": "2022-08-06T00:00:00",
"id": "CYCLE_223894_e0fab919-b50b-4b9f-ac09-52f77474fa7a",
"name": "Frequency.DAILY_2022-08-06T15:45:50.223894"
}
]
```
If there is no cycle, 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/cycles")
print(response)
print(response.json())
```
In case of success here is an output example:
```
<Response [200]>
[{
"frequency": "Frequency.DAILY",
"end_date": "2022-08-06T23:59:59.999999",
"creation_date": "2022-08-06T15:45:50.223894",
"start_date": "2022-08-06T00:00:00",
"id": "CYCLE_223894_e0fab919-b50b-4b9f-ac09-52f77474fa7a",
"name": "Frequency.DAILY_2022-08-06T15:45:50.223894"
}
]
```
If there is no cycle, 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/CycleSchema'
post:
tags:
- api
description: |
Creates a new cycle from the CycleSchema given in the request body.
!!! Example
=== "Curl"
```shell
curl -X POST -H "Content-Type: application/json" -d '{"frequency": "DAILY", "properties": {}, "creation_date": "2020-01-01T00:00:00", "start_date": "2020-01-01T00:00:00", "end_date": "2020-01-01T00:00:00"}' http://localhost:5000/api/v1/cycles
```
In this example the REST API is served on port 5000 on localhost. We are using curl command line
client.
In the curl command line, a `CycleSchema^` is provided as JSON dictionary parameter with the curl
option -d (--data) to specify the various attributes of the `Cycle^` to create:
``` JSON
{
"frequency": "DAILY",
"properties": {},
"creation_date": "2020-01-01T00:00:00",
"start_date": "2020-01-01T00:00:00",
"end_date": "2020-01-01T00:00:00"
}
```
=== "Python"
This Python example requires the 'requests' package to be installed (`pip install requests`).
```python
import requests
cycle_schema = {
"frequency": "DAILY",
"properties": {},
"creation_date": "2020-01-01T00:00:00",
"start_date": "2020-01-01T00:00:00",
"end_date": "2020-01-01T00:00:00"
}
response = requests.post("http://localhost:5000/api/v1/cycles", json=cycle_schema)
print(response)
print(response.json())
```
A `CycleSchema^` is provided as a dictionary to specify the various attributes of the `Cycle^` to
create.
Here is the output example:
```
<Response [201]>
{
'message': 'Cycle was created.',
'cycle': {
'frequency': 'Frequency.DAILY',
'end_date': '2020-01-01T00:00:00',
'creation_date': '2020-01-01T00:00:00',
'start_date': '2020-01-01T00:00:00',
'id': 'CYCLE_c9cc527f-a8c8-4238-8f31-42166a9817db',
'name': 'Frequency.DAILY_2020-01-01T00:00:00',
'properties': {}}}
```
!!! Note
When the authorization feature is activated (available in Taipy Enterprise edition only), this endpoint
requires the `TAIPY_EDITOR` role.
requestBody: required: true content: application/json: schema: CycleSchema responses: 201: content: application/json: schema: type: object properties: message: type: string description: Status message. cycle: CycleSchema