Skip to content

Paths for cycle

Entry points that interact with Cycle entities.

/api/v1/cycles/

GET

Returns a CycleSchema list representing all existing Cycles.

Example

    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:

[
    {
    "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:

[]

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

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

POST

Creates a new cycle from the CycleSchema given in the request body.

Example

    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:

{
    "frequency": "DAILY",
    "properties": {},
    "creation_date": "2020-01-01T00:00:00",
    "start_date": "2020-01-01T00:00:00",
    "end_date": "2020-01-01T00:00:00"
}

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

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.

Request body:

CycleSchema

Responses

/api/v1/cycles/{cycle_id}/

DELETE

Deletes the Cycle identified by the cycle_id given as parameter. If the cycle does not exist, a 404 error is returned.

Example

    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:

{"message": "Cycle CYCLE_223894_e0fab919-b50b-4b9f-ac09-52f77474fa7a was deleted."}

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

{"message": "Cycle CYCLE_223894_e0fab919-b50b-4b9f-ac09-52f77474fa7a 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/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

Name Type Required Description
cycle_id string Yes The id of the cycle to delete.

Responses

  • 200
    Status: OK

    Name Type
    message string
  • 404
    Status: Not Found

    No cycle has the cycle_id identifier.

GET

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 -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:

{"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:

{"message": "Cycle CYCLE_223894_e0fab919-b50b-4b9f-ac09-52f77474fa7a 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/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

Name Type Required Description
cycle_id string Yes The identifier of the cycle to retrieve.

Responses