API - Planyo Web Services - add_resource

Sie sind hier: Planyo » Hilfe » API » add_resource

add_resource (version 1)

Description:

Use this function to add a new resource to your Planyo site. The new resource is created by making an exact copy of an existing resource (it can be an unpublished resource which you can keep on your site free of charge just for this purpose), including custom resource properties (images are not duplicated). You can additionally use optional parameters to override base resource's settings. The only required parameter from this group is the name of the new resource.

Input:

base_resource_id int required
ID of the resource used as a base for the new resource.
name string required
Name of the new resource
quantity int required
Quantity of the new resource
predefined_duration_count int optional
In case you want to use predefined durations (see time-related settings in resource settings or Q228), specify the number of durations in this parameter. You should also pass the actual durations and their descriptions in the parameters: predefined_duration_text_X and predefined_duration_hours_X (where X is a number from 1 to the value of predefined_duration_count). If you don't want to use predefined durations, or want to use the base resource's settings, don't pass this parameter.
min_rental_time float optional
You can override the base resource's minimum rental time (expressed in hours) by specifying this parameter. This is ignored if you specified predefined_duration_count
max_rental_time float optional
You can override the base resource's maximum rental time (expressed in hours) by specifying this parameter. This is ignored if you specified predefined_duration_count
available_from int optional
You can override the base resource's setting Available on working days from. This only applies to hour-based resources. This should be a single integer (using a 24-hour clock), e.g. 8 means 8am.
available_until int optional
You can override the base resource's setting Available on working days until. This only applies to hour-based resources. This should be a single integer (using a 24-hour clock), e.g. 18 means 6pm.
start_times string optional
You can override the base resource's setting Restrict starting times. This only applies to hour-based resources. The different times should be comma-separated.
min_hours_to_rental int optional
You can override the base resource's setting Min. time between reservation and rental. This is an integer, time is expressed in hours.
max_days_to_rental int optional
You can override the base resource's setting Max. time between reservation and rental. This is an integer, time is expressed in days.
default_price string optional
You can override the base resource's default price (first row in the pricing manager). This can be also used to specify a new custom pricing script (see Q137 in the FAQ).
resource_admin_id int optional
You can override the base resource's resource admin ID. The new resource admin must be either an existing resource admin or moderator. New users without an administrative role in this Planyo site are not allowed to be admins.
event_dates string optional
If you set this parameter, the resource will become an event-type resource. Here you can specify comma-separated start dates or start dates and times (in the same way as in resource settings).
is_published bool optional
By default the new resource will be published. You can set this to false if you want it to be unpublished.
prop_res_xyz string optional
Resource-specific properties (defined in the admin panel in: Site settings / Custom resource properties). E.g. for a custom property 'distance to sea', this would be prop_res_distance_to_sea (where '_' replaces all space characters).
images string optional
You can pass comma-separated full URLs (starting with http:// or https://) of images to be downloaded by Planyo and used for the new resource.
version float optional
you can optionally specify the version of the API that you're using. Use the value of latest or simply skip this parameter to use the latest API version. The latest version is: 1
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_resource_id int
ID of the newly created resource (in case of success).

API playground:

Click here to test this function in the API playground.