API - Planyo Web Services - list_resources

Ti trovi qui: Planyo » Aiuto » API » list_resources

list_resources

Description:

Returns resources defined in a Planyo site or meta site along with additional information and photos. You can specify a resource filter. Note: old name of this function was get_all_resources. You can still use that function name instead.

Input:

detail_level int optional
Sum of one or more of the following integers (ORed value): 1=resource name, 2=resource settings (quantity, site_id, confirmation_type, category, unit_names, resource admin info), 4=resource properties (resource-specific properties), 8=resource photos. Default value is 1 (name only).
page int optional
Zero-based page number. The default is 0. Max. number of results per page is defined by by default 100. Note: you can change the page size (max 300) with the page_size parameter.
list_published_only bool optional
Set to true if you only want published resources to be returned. False (default) will list all resources.
list_reservable_only bool optional
Set to true if you only want reservable resources to be returned. A resource is not reservable if it can be only reserved as part of a package. False (default) will list all resources.
list_resource_types string optional
Skip this parameter or set to all in order to return all resources. Set it to one of the following values (or multiple comma-separated values) to filter the resource types returned: resource, bundle, package. This allows you to filter out normal base resources, packages and/or bundles from the returned listing.
admin_id int optional
You can optionally filter the resources returned by the ID of the resource administrator. When this parameter is skipped, all resources will be returned.
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). If you want to look for values greater or less than a specific number (e.g. hotels with specific max. distance to sea), prefix the value with one of the following operators: <, >, <=, >=, <> e.g. prop_res_distance_to_sea = <500. On the other hand, the [inlcude] prefix finds values that include the requested text, e.g. 'prop_res_desc = [include]find me'.
ppp_gps_coords_radius string optional
If you want to do a geolocation search (see Q281 for more about this), you must pass the distance from a point using this parameter (use the 'm' suffix to indicate if the distance is in miles, for kilometers use the 'km' suffix or no suffix at all, just a float) and you should set the coordinates of the search point (latitude followed by a comma and then longitude in decimal degrees, e.g. 46.17,8.80) using the parameter prop_res_gps_coords (if the coordinates of the resources should be used) or prop_cal_gps_coords (if the coordinates on the site level should be used -- only for metasite api keys). Only the results within specified distance from the given point will be returned. Additionally the distance in kilometers will be returned for each result ('distance' key).
ppp_resfilter string optional
This parameter allows you to additionally limit the returned resources. You can do this by specifying a comma-separated list containing resource IDs. For example, ppp_resfilter=1,2,3 will list the resources with IDs equal to 1, 2 and 3. Note that other parameters can limit the returned list even further.
sort string optional
Sort criterium. One of: resname (resource name), site (site ID), location, prop_res_xyz (sorted by one of the 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)
site_id int optional
If using an API key for a meta site, you can limit the results to a single site ID.
method string required
must be set to list_resources
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:

resource_count int
Total number of resources. Note: this can be greater than the number of resources returned because of the max. page size limit set to 100.
max_page int
Max. page number (page numbers are zero-based).
resources array
Array of resources. Each item is a named array with one or more of the following keys (depending on the specified detail_level): id, name, quantity, site_id, confirmation_type, unit_price, currency, category, is_published, min_rental_time, max_rental_time, min_time_between_rentals, min_hours_to_rental, max_days_to_rental, start_times, predefined_durations, time_unit, is_overnight_stay, unit_names, resource_admin_id, resource_admin_email, resource_admin_name, properties (array of all resource-specific properties -- name => value -- defined in the admin panel in: Site settings / Custom resource properties), photos (array of photos containing following keys: id, path, title). See the function get_resource_info for description of the items returned. For metasites, site information is also returned (site_id and site_name).

Sample:

Click here for a PHP sample which you can embed into your webpage

API playground:

Click here to test this function in the API playground.