API - Planyo Web Services - set_weekly_schedule

You are here: Planyo » Help » API » set_weekly_schedule

set_weekly_schedule

Description:

Use this function to specify the regular working / unavailable hours for given resource (or all resources; see the resource_id parameter). One way to use this function is to determine the working hours of a resource. In this scenario, set default to 0 and pass all available periods using the av-XXX parameters. Example: default=0&av-mon-0800-1800=1&av-wed-0800-1800=1 (resource is available ONLY on Mondays and Wednesdays between 8am and 6pm). You can also use this function using the standard Planyo logic, that is, assuming the resource is always available (but within the working hours determined in resource settings) and specifying a list of periods when the resource should not be available for reservations. Example: default=1&av-mon-1200-1400=0&av-tue-1200-1400=0&av-wed-1200-1400=0&av-thu-1200-1400=0&av-fri-1200-1400=0 (resource is not available during lunch hours on weekdays, lunch hours are 12:00 until 14:00). This function will not modify resource's working hours but will remove all existing recurring weekly vacations and will create new vacations based on the parameters passed.

Input:

resource_id int optional
ID of the resource whose availability will be updated. If setting availability for the entire site, you can skip this parameter. In such case, set the site id in the site_id parameter but only when using a meta site API key
default int required
Default availability for all time units of the week (0=unavailable by deafult, 1=available by default). Set to 0 if this function is used to specify periods of availability. Set to 1 if this function is used to specify periods of unavailability (vacations).
av-D-HHMM-HHMM int optional
Availability for the time range defined as follows: D - stands for the weekday expressed numerically (1=monday .. 7=sunday) or as a 3 letter weekday name in English (mon .. sun); HHMM - start and end time of the current time range. H stands for hours (24-hour format) and M stands for minutes. MM must be one of the following: 00, 15, 30, 45. The value of this parametr determines if the resource should be available during the specified time range: 0=unavailable, 1=available. Examples of this parameter: av-7-0800-0930=1 (Sundays from 8am till 9:30am this resource is available), av-mon-1330-1830=0 (Mondays from 1:30pm till 6:30pm this resource is unavailable). Note that you can pass as many parameters in this format as you like, e.g. passing individual hour periods souch as av-1-0800-0900=1&av-1-0900-1000=1&av-1-1000-1100=1 is the same as passing av-1-0800-1100=1 (the number of vacations created will be exactly the same).
method string required
must be set to set_weekly_schedule
language string optional
by specifying a 2-letter (ISO 639-1) language code (all capital letters e.g. EN, DE, FR, ES, IT) you can change the language of the text values returned
api_key string required
your API key - Click here to get your key. If your API key uses a hash key, you must also include the parameters hash_key and hash_timestamp.

Output:

vacations_created int
Number of weekly recurring vacations which were created by this function.

API playground:

Click here to test this function in the API playground.