API - Planyo Web Services - list_vouchers

Estás aquí: Planyo » Ayuda » API » list_vouchers

list_vouchers

Description:

Lists vouchers. You can specify a number of parameters to filter the results, for example only so that the vouchers which can be used for a specific reservation parameters (dates/resource id) can be returned.

Input:

rental_start_time DateTime optional
If passed, the vouchers returned will be limited to those which allow the rental to start on specified date
rental_end_time DateTime optional
If passed, the vouchers returned will be limited to those which allow the rental to end on specified date
resource_id int optional
If you specify resource ID only vouchers which can be used for this resource will be listed.
site_id int optional
Setting site_id and not specifying any resource_id will list vouchers compatible with multiple resources. If you specified a resource_id you may leave this parameter empty. If your api key is valid for a single site, you can also leave this empty.
voucher_code_prefix string optional
You can enter a voucher code or just a voucher code prefix. In such case only vouchers starting with given code will be listed.
check_reservation_time bool optional
If true, then only vouchers which can be used for reservations entered at the time of making this call will be returned. Otherwise, vouchers which can be used for reservations entered at any time will be listed.
method string required
must be set to list_vouchers
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:

results array
Array whose items are named arrays with the following keys: voucher_id, code, quantity, quantity_used, reservation_start_date, reservation_end_date, discount_value, unique_codes, non_combinable, rental_start_date, rental_end_date, voucher_title, resources (comma-separated list of compatible resource ids -- passed only when the resource_id parameter is empty), codes (list of codes, returned only if voucher codes are unique), codes_used (list of codes already used up, returned only if voucher codes are unique), metasite_id (if the voucher is valid for an entire metasite)

API playground:

Click here to test this function in the API playground.