API - Planyo Web Services - set_resource_availability

Jesteś tutaj: Planyo » Pomoc » API » set_resource_availability

set_resource_availability

Description:

Use this function to set availability in bulk (for a number of days or time units). Availability is set exactly in the same way as in the backend in Schedule&Reports / Availability calendar -- you can both increase and decrease the available quantity. Please note that you cannot increase the quantity beyond the number of NON-RESERVED units. Trying to do so will make as many units available as possible and will generate a warning.

Input:

resource_id int required
ID of the resource whose availability will be updated
timeXXX int required
Availability at specified date (for day-based resources) or date and time (for hour and quarter-hour resources). This is not a single parameter, you can pass as many times as you like, for example you can set 30 different parameters to update availability of an entire month in bulk. XXX in the parameter name can be a timestamp or date in format YYYY-MM-DD or for hour-based resources: YYYY-MM-DD_HH:MM. Example: time2015-01-01=5&time2015-01-02=3&time2015-01-03=0 will update the first 3 days of january 2015 by setting 5, 3 and 0 rooms as available. If quantity of your resource is 1, then always use 0 or 1 as the value of this parameter.
update_channels bool optional
Set to true if your site uses extensions (such as Booking.com) where availability must be also updated accordingly
method string required
must be set to set_resource_availability
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:

new_availability array
Resulting availability for the dates specified in input parameters. This array will use timestamps as keys.
total_times_processed int
Number of time units processed (all passed except when an error has occurred)
total_times_modified int
Number of time units modified by this call
total_errors_and_warnings int
Number of errors and warnings
errors array
Errors encountered (one for each input time)
warnings array
Warnings encountered (one for each input time). Warnings will be generated if desired quantity cannot be made available. E.g. if you have a total quantity of 5, and 2 are reserved, and trying to make 4 available will only make 3 available and a warning will be generated.

API playground:

Click here to test this function in the API playground.