Other endpoints

Case endpoints

External endpoints to manage the cases: create new cases from raw data, from an existing instance or execution or from an existing case, update the case info, patch its data, get all of them or one, move them and delete them. These endpoints have different access url, but manage the same data entities

class cornflow.endpoints.case.CaseEndpoint

Bases: BaseMetaResource

Endpoint used to create a new case or get all the cases and their related information

ROLES_WITH_ACCESS = [1, 2, 3]
get(**kwargs)

API (GET) method to get all directory structure of cases for the user It requires authentication to be passed in the form of a token that has to be linked to an existing session (login) made by a user

Returns:

a dictionary with a tree structure of the cases and an integer with the HTTP status code

Return type:

Tuple(dict, integer)

post(**kwargs)
methods: t.ClassVar[t.Collection[str] | None] = {'GET', 'POST'}

The methods this view is registered for. Uses the same default (["GET", "HEAD", "OPTIONS"]) as route and add_url_rule by default.

class cornflow.endpoints.case.CaseFromInstanceExecutionEndpoint

Bases: BaseMetaResource

Endpoint used to create a new case from an already existing instance and execution

ROLES_WITH_ACCESS = [2, 3]
post(**kwargs)

API method to create a new case from an existing instance or execution

methods: t.ClassVar[t.Collection[str] | None] = {'POST'}

The methods this view is registered for. Uses the same default (["GET", "HEAD", "OPTIONS"]) as route and add_url_rule by default.

class cornflow.endpoints.case.CaseCopyEndpoint

Bases: BaseMetaResource

Copies the case to a new case. Original case id goes in the url

ROLES_WITH_ACCESS = [2, 3]
post(idx)
methods: t.ClassVar[t.Collection[str] | None] = {'POST'}

The methods this view is registered for. Uses the same default (["GET", "HEAD", "OPTIONS"]) as route and add_url_rule by default.

class cornflow.endpoints.case.CaseDetailsEndpoint

Bases: BaseMetaResource

Endpoint used to get the information of a single case, edit it or delete it

ROLES_WITH_ACCESS = [1, 2, 3]
get(idx)

API method to get an case created by the user and its related info.

Parameters:

idx (str) – ID of the case

Returns:

A dictionary with a message and an integer with the HTTP status code.

Return type:

Tuple(dict, integer)

put(idx, **kwargs)

API method to edit a case created by the user and its basic related info (name, description and schema).

Parameters:

idx (int) – ID of the case

Returns:

A dictionary with a confirmation message and an integer with the HTTP status code.

Return type:

Tuple(dict, integer)

delete(idx)

API method to delete an existing case. It requires authentication to be passed in the form of a token that has to be linked to an existing session (login) made by a user.

Parameters:

idx (int) – ID of the case

Returns:

A dictionary with a confirmation message and an integer with the HTTP status code.

Return type:

Tuple(dict, integer)

methods: t.ClassVar[t.Collection[str] | None] = {'DELETE', 'GET', 'PUT'}

The methods this view is registered for. Uses the same default (["GET", "HEAD", "OPTIONS"]) as route and add_url_rule by default.

class cornflow.endpoints.case.CaseDataEndpoint

Bases: CaseDetailsEndpoint

Endpoint used to get the data of a given case

ROLES_WITH_ACCESS = [1, 2, 3]
get(idx)

API method to get data for a case by the user and its related info. It requires authentication to be passed in the form of a token that has to be linked to an existing session (login) made by a user.

Parameters:

idx (int) – ID of the case

Returns:

A dictionary with a message (error if authentication failed, or the execution does not exist or the data of the instance) and an integer with the HTTP status code.

Return type:

Tuple(dict, integer)

patch(**kwargs)
methods: t.ClassVar[t.Collection[str] | None] = {'DELETE', 'GET', 'PATCH', 'PUT'}

The methods this view is registered for. Uses the same default (["GET", "HEAD", "OPTIONS"]) as route and add_url_rule by default.

class cornflow.endpoints.case.CaseToInstance

Bases: BaseMetaResource

Endpoint used to create a new instance or instance and execution from a stored case

ROLES_WITH_ACCESS = [2, 3]
post(idx)

API method to copy the information stored in a case to a new instance It requires authentication to be passed in the form of a token that has to be linked to an existing session (login) made by a user

Parameters:

idx (int) – ID of the case that has to be copied to an instance or instance and execution

Returns:

an object with the instance or instance and execution ID that have been created and the status code

Return type:

Tuple (dict, integer)

methods: t.ClassVar[t.Collection[str] | None] = {'POST'}

The methods this view is registered for. Uses the same default (["GET", "HEAD", "OPTIONS"]) as route and add_url_rule by default.

class cornflow.endpoints.case.CaseCompare

Bases: BaseMetaResource

Endpoint used to generate the json patch of two given cases

ROLES_WITH_ACCESS = [1, 2, 3]
get(idx1, idx2, **kwargs)

API method to generate the json patch of two cases given by the user It requires authentication to be passed in the form of a token that has to be linked to an existing session (login) made by a user

Parameters:
  • idx1 (int) – ID of the base case for the comparison

  • idx2 (int) – ID of the case that has to be compared

:return:an object with the instance or instance and execution ID that have been created and the status code :rtype: Tuple (dict, integer)

methods: t.ClassVar[t.Collection[str] | None] = {'GET'}

The methods this view is registered for. Uses the same default (["GET", "HEAD", "OPTIONS"]) as route and add_url_rule by default.