API - Planyo Web Services - add_recurring_vacation

Jesteś tutaj: Planyo » Pomoc » API » add_recurring_vacation

add_recurring_vacation

Description:

Adds a new recurring vacation for given resource or entire Planyo site.

Input:

recurrence_type string optional
One of the values: 'day' - repeated everyday (hour based resources only), 'week' - repeated every week, 'month' - repeated every month, 'year' - repeated every year. Note that the meaning of the start and end time parameters below depends on the recurrence type.
start_time DateTime required
Vacation start time. Can be a timestamp or text (e.g. '2016-07-22', '2016-07-22 15:00', 1460033800). Note that depending on the recurrence type, start and end time have a different meaning:
 Description
dayFor the 'day' recurrence, only the time part of the start and end time parameters is used. This means that both '1980-05-21 16:15' and '16:15' are considered equal. When start time is before end time, a single vacation is added. For example, for start_time='12:00' and end_time='14:00' a single vacation starting at 12:00 and ending at 13:59 will be added. On the other hand, if start time is after end time, then two 'day' vacations will be added. For example, the values start_time='14:00' and end_time='12:00' will add two vacations: 14:00-23:59 and 00:00-11:59 that will be applied to each day.
weekIn this case the weekday of the start and end params is taken. Note that the values: '2016-04-07 12:00' and 'Thursday 12:00' are considered the same as '2016-04-07' is Thursday. For hour-based resources, the time part of both values is also used (for resources being reserved on day basis time is not considered).
When weekday of the both start and end time params is the same, a single vacation repeated every week will be added. For example, for start_time='Monday' and end_time='Monday' a single vacation for 'Monday' will be added. On the other hand, for start_time='Friday' and end_time='Monday' there will be four vacations added: for 'Friday', 'Saturday', 'Sunday' and 'Monday'.
For hour-based resources, the start and end time is also used. For start_time='Friday 12:00' and end_time='Saturday 15:00' there will be two vacations added: 'Friday, 12:00' - 'Firday, 23:59' and 'Saturday, 00:00' - 'Saturday, 14:59'.
monthFor this recurrence type we take only the day value of both start and end time. For the following dates '2016-04-02' and '1980-11-02' the day value is the same and equals 2. For example, for start_time='2016-07-02' and end_time='2016-07-03' the vacation repeated every month from the 2nd to the 3rd day will be added.
yearIn this case, the month and day values for both start and end time are taken. So, for both '2016-04-02' and '1980-04-02' the month is April and the day value is 2.
For example, for start_time='2016-08-10' and end_time='2016-08-12' a single vacation repeated every year for the period of 'August 10th - August 12th' will be added. On the other hand, when the start month/day is after end month/day, two vacations will be added. For example, for start_time='2016-12-20' and end_time='2016-01-05' there will be two vacations added: 'December 20th - December 31st' and 'January 1st - January 5th'.
end_time DateTime required
Vacation end time. Can be a timestamp or text. See 'start_time' above for the detailed information.
resource_id int required
If you specify resource ID, the vacation will be added only for this resource. If you leave this empty, vacation will be added for the whole site.
site_id int required
Setting site_id and not specifying any resource_id will add a global vacation (for the whole site).
quantity int required
Enter the number of resources which should be made unavailable. In case you don't work with quantities, you can skip this parameter.
comment string required
Describe the vacation.
valid_from DateTime required
Specified when vacation validity is limited to a specific period.
valid_until DateTime required
Specified when vacation validity is limited to a specific period.
method string required
must be set to add_recurring_vacation
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:

dates string
Textual information about the added vacations, e.g. 'Every Monday'.
count int
Number of vacations added. Note that for some recurrence types and start/end dates combination there can be more than one vacation added.
vacation_ids string
A comma-separated list of added vacation IDs.

API playground:

Click here to test this function in the API playground.