API Playground - list_coupons

list_coupons


Lists the purchased coupons. You can specify a number of parameters to filter the results. (click for full documentation)

resource_id

If you specify resource ID only coupons which can be used for this resource will be listed.

site_id

Setting site_id and not specifying any resource_id will list coupons compatible with multiple resources. If your api key is valid for a single site, you can leave this empty. When using a metasite api key, you can specify a site to list the coupons from that site only. You can also use a special value all which will list coupons on the site level for all the sites belonging to the meta site.

coupon_code

You can enter a coupon code if you want to list only coupons with this code.

email

You can enter an email address if you want to list only coupons purchased for this email address.

check_if_valid

If true, only coupons which can still be used are returned. This basically checks if the amount is greater than 0 and for the 'valid for given number of days' coupon type, the valid-until date is checked against the rental_time parameter (only if passed)

include_reservations

If true, all reservations for which given coupon was used will be returned in the results

include_usage_data

If true, the amount of the coupon that was already used (amount_used) and the last time the coupon was used (latest_usage_time) will be returned in the results

rental_time

If passed AND if check_if_valid is true, only coupons which can still be used at the time passed in this parameter will be returned. Please note that Planyo checks if the rental's end time lies within the coupon's validity date.

type

If passed, only coupons matching the specified type will be returned. If not specified, the function will return coupons of all types. The allowed values are: 1 - Prepaid amount, 2 - Number of hours, 3 - Number of entries, 4 - Valid for given number of days, 5 - Discount valid for given number of days.

page

Zero-based page number. The default is 0. Each page lists max 5000 coupons. Note: you can change the page size (max 5000) with the page_size parameter

language

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

* - pole wymagane