import os
from cognite.client.data_classes import ClientCredentials
schedule = client.functions.schedules.create(
name="My schedule",
function_id=123,
cron_expression="*/5 * * * *",
client_credentials=ClientCredentials("my-client-id", os.environ["MY_CLIENT_SECRET"]),
description="This schedule does magic stuff.",
data={"magic": "stuff"},
)
schedule = client.functions.schedules.create(
name="My schedule",
function_id=456,
cron_expression="*/5 * * * *",
description="A schedule just used for some temporary testing.",
){
"items": [
{
"id": 4503599627370496,
"name": "My schedule",
"createdTime": 1730204346000,
"cronExpression": "* * * * *",
"when": "Every hour",
"sessionId": "<string>",
"description": "This is a nice schedule",
"functionId": 4503599627370496,
"functionExternalId": "my.known.id"
}
]
}Required capabilities:
functionsAcl:WRITE
Create function schedules. Function schedules trigger asynchronous calls with specific input data, based on a cron expression that determines when these triggers should be fired. Use e.g. http://www.cronmaker.com to be guided on how to generate a cron expression. One of FunctionId or FunctionExternalId (deprecated) must be set (but not both). When creating a schedule with a session, i.e. with a nonce, FunctionId must be used. The nonce will be used to bind the session before function execution, and the session will be kept alive for the lifetime of the schedule. WARNING: Secrets or other confidential information should not be passed via the data object. There is a dedicated secrets object in the request body to “Create functions” for this purpose.
import os
from cognite.client.data_classes import ClientCredentials
schedule = client.functions.schedules.create(
name="My schedule",
function_id=123,
cron_expression="*/5 * * * *",
client_credentials=ClientCredentials("my-client-id", os.environ["MY_CLIENT_SECRET"]),
description="This schedule does magic stuff.",
data={"magic": "stuff"},
)
schedule = client.functions.schedules.create(
name="My schedule",
function_id=456,
cron_expression="*/5 * * * *",
description="A schedule just used for some temporary testing.",
){
"items": [
{
"id": 4503599627370496,
"name": "My schedule",
"createdTime": 1730204346000,
"cronExpression": "* * * * *",
"when": "Every hour",
"sessionId": "<string>",
"description": "This is a nice schedule",
"functionId": 4503599627370496,
"functionExternalId": "my.known.id"
}
]
}Access token issued by the CDF project's configured identity provider. Access token must be an OpenID Connect token, and the project must be configured to accept OpenID Connect tokens. Use a header key of 'Authorization' with a value of 'Bearer $accesstoken'. The token can be obtained through any flow supported by the identity provider.
1 elementShow child attributes
Created
Show child attributes
Was this page helpful?