Schedule Management
Manage scheduled HTTP requests with the Cronhost SDK
Schedule Management
The Schedule Management section covers all operations related to creating, updating, and managing scheduled HTTP requests.
Get All Schedules
Retrieve all schedules for the authenticated user.
Returns: Promise<Schedule[]>
Get Schedule by ID
Retrieve a specific schedule by its ID.
Parameters:
id
(string, required): The unique identifier of the schedule
Returns: Promise<Schedule>
Create Schedule
Create a new scheduled HTTP request.
Parameters:
name
(string, required): A descriptive name for the scheduledescription
(string, optional): Additional description of what the schedule doescronExpression
(string, required): Valid cron expression defining when to runtimezone
(string, required): IANA timezone identifier (e.g., ‘America/New_York’) - View all optionsendpoint
(string, required): The HTTP endpoint to callhttpMethod
(“GET” | “POST” | “PUT” | “DELETE” | “PATCH”, required): HTTP method to usebody
(string, optional): Request body for POST/PUT/PATCH requestsheaders
(Record<string, string>
, optional): HTTP headers to include in the requestmaxRetries
(number, optional): Maximum number of retry attempts (default: 3)timeoutSeconds
(number, optional): Request timeout in seconds (default: 30)
Returns: Promise<Schedule>
Update Schedule
Update an existing schedule.
Parameters:
id
(string, required): The unique identifier of the schedule to updatedata
(UpdateScheduleData, required): Object containing fields to update
UpdateScheduleData fields (all optional):
name
(string): Update the schedule namedescription
(string): Update the descriptioncronExpression
(string): Update the cron expressiontimezone
(string): Update the timezoneendpoint
(string): Update the endpoint URLhttpMethod
(“GET” | “POST” | “PUT” | “DELETE” | “PATCH”): Update HTTP methodbody
(string): Update request bodyheaders
(Record<string, string>
): Update HTTP headersmaxRetries
(number): Update retry limittimeoutSeconds
(number): Update timeout
Returns: Promise<Schedule>
Delete Schedule
Delete a schedule permanently.
Parameters:
id
(string, required): The unique identifier of the schedule to delete
Returns: Promise<void>
Toggle Schedule
Enable or disable a schedule without deleting it.
Parameters:
id
(string, required): The unique identifier of the scheduleenabled
(boolean, required): Whether to enable (true) or disable (false) the schedule
Returns: Promise<Schedule>
Trigger Schedule
Manually trigger a schedule to run immediately, regardless of its cron schedule.
Parameters:
id
(string, required): The unique identifier of the schedule to trigger
Returns: Promise<Job>
- Returns the created job that will execute the request