Schedules

A Schedule is a named, reusable weekday-and-time schedule shared by scheduled resources across a Site.

List Schedules

SDK Method

Schedule.List();

Return Object

FilesList<Schedule>

Authorization Requirement

Requires a Site-Wide API key, or a User API key or session from a Site Administrator, a Workspace Administrator for the relevant workspace, or a Folder Administrator for the relevant folder.

Additional Arguments

Example Request

using FilesCom.Models;

try
{
    var scheduleIterator = Schedule.List();
    await foreach (Schedule schedule in scheduleIterator.ListAutoPagingAsync()) {
        // Operate on schedule
    }
}
catch (FilesCom.NotAuthenticatedException e)
{
    Console.WriteLine($"Authentication Error Occurred ({e.GetType().Name}): " + e.Message);
}
catch (FilesCom.SdkException e)
{
    Console.WriteLine($"Unknown Error Occurred ({e.GetType().Name}): " + e.Message);
}

Show Schedule

SDK Method

Schedule.Find();

Return Object

Schedule

Authorization Requirement

Requires a Site-Wide API key, or a User API key or session from a Site Administrator, a Workspace Administrator for the relevant workspace, or a Folder Administrator for the relevant folder.

Method Arguments

ArgumentDescription
id
int64
Required
Schedule ID.

Example Request

using FilesCom.Models;

try
{
    var schedule = await Schedule.Find(1L);
    // Operate on schedule
}
catch (FilesCom.NotAuthenticatedException e)
{
    Console.WriteLine($"Authentication Error Occurred ({e.GetType().Name}): " + e.Message);
}
catch (FilesCom.SdkException e)
{
    Console.WriteLine($"Unknown Error Occurred ({e.GetType().Name}): " + e.Message);
}

Create Schedule

SDK Method

Schedule.Create();

Return Object

Schedule

Authorization Requirement

Requires a Site-Wide API key, or a User API key or session from a Site Administrator.

Method Arguments

ArgumentDescription
name
string
Required
Schedule name.
schedule_days_of_week
array(int64)
Required
0-based weekdays used by the Schedule. 0 is Sunday.
schedule_times_of_day
array(string)
Required
Times of day in HH:MM format (24-hour).
schedule_time_zone
string
Time zone for scheduled times. If not set, times are interpreted as UTC.
holiday_region
string
Optional holiday region on which linked resources do not run.

Example Request

using FilesCom.Models;

var parameters = new Dictionary<string, object>();
parameters.Add("name", "Weekday overnight");
parameters.Add("schedule_days_of_week", new Nullable<Int64>[] { 1, 2, 3, 4, 5 });
parameters.Add("schedule_times_of_day", new string[] { "01:00" });

try
{
    var schedule = await Schedule.Create(parameters);
    // Operate on schedule
}
catch (FilesCom.NotAuthenticatedException e)
{
    Console.WriteLine($"Authentication Error Occurred ({e.GetType().Name}): " + e.Message);
}
catch (FilesCom.SdkException e)
{
    Console.WriteLine($"Unknown Error Occurred ({e.GetType().Name}): " + e.Message);
}

Update Schedule

SDK Method

schedule.Update();

Return Object

Schedule

Authorization Requirement

Requires a Site-Wide API key, or a User API key or session from a Site Administrator.

Method Arguments

ArgumentDescription
name
string
Schedule name.
schedule_days_of_week
array(int64)
0-based weekdays used by the Schedule. 0 is Sunday.
schedule_times_of_day
array(string)
Times of day in HH:MM format (24-hour).
schedule_time_zone
string
Time zone for scheduled times. If not set, times are interpreted as UTC.
holiday_region
string
Optional holiday region on which linked resources do not run.

Example Request

using FilesCom.Models;

var parameters = new Dictionary<string, object>();
parameters.Add("name", "Weekday overnight");

try
{
    // Find the schedule object by its id.
    var schedule = await Schedule.Find(1L);
    await schedule.Update(parameters);
}
catch (FilesCom.NotAuthenticatedException e)
{
    Console.WriteLine($"Authentication Error Occurred ({e.GetType().Name}): " + e.Message);
}
catch (FilesCom.SdkException e)
{
    Console.WriteLine($"Unknown Error Occurred ({e.GetType().Name}): " + e.Message);
}

Delete Schedule

SDK Method

schedule.Delete();

Return Object

No return value.

Authorization Requirement

Requires a Site-Wide API key, or a User API key or session from a Site Administrator.

Example Request

using FilesCom.Models;

var parameters = new Dictionary<string, object>();

try
{
    // Find the schedule object by its id.
    var schedule = await Schedule.Find(1L);
    await schedule.Delete(parameters);
}
catch (FilesCom.NotAuthenticatedException e)
{
    Console.WriteLine($"Authentication Error Occurred ({e.GetType().Name}): " + e.Message);
}
catch (FilesCom.SdkException e)
{
    Console.WriteLine($"Unknown Error Occurred ({e.GetType().Name}): " + e.Message);
}

The Schedule Object

Some of the methods above return a Schedule object. The attributes of this object are listed below.

AttributeDescription
id
int64
Schedule ID.
name
string
Schedule name.
schedule_days_of_week
array(int64)
0-based weekdays used by the Schedule. 0 is Sunday.
schedule_times_of_day
array(string)
Times of day in HH:MM format (24-hour).
schedule_time_zone
string
Time zone for scheduled times. If not set, times are interpreted as UTC.
holiday_region
string
Optional holiday region on which linked resources do not run.
human_readable_schedule
string
Human-readable Schedule description.
created_at
date-time
Creation time.
updated_at
date-time
Last update time.