List all coupons of a guest
Provide unique identifier of the guest as guest_id and this api will retrieve the coupon history of the respective guest.
you can also use pagination by passing page and size query parameters if guest has huge number of records. By default page is set to 1 and size is set to 10. Size cannot be more than 100 which means maximum records per page cannot be more than 100.
Before you begin
- You need a valid API key or access token. See Set up API authentication.
Permission: Manage API Keys (on the Administrator security object) — Required to access Zenoti APIs.
Endpoint
GET /v1/guests/{guest_id}/coupons
Base URL: https://api.zenoti.com
Request
Headers
| Header | Required | Description |
|---|---|---|
| Authorization | Yes | bearer {{access_token}} |
Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| guest_id | string | Yes | Unique identifier of the guest. |
Response
Success (200 OK)
{
"coupons": [
{
"...": "..."
}
],
"page_info": {
"total": 4,
"page": 1,
"size": 10
}
}
Response fields
| Field | Type | Description |
|---|---|---|
| coupons | object[] | |
| coupons[].id | string | |
| coupons[].number | string | |
| coupons[].invoice_id | string | |
| coupons[].invoice_number | string | |
| coupons[].reciept_number | string | |
| coupons[].description | string | |
| coupons[].issue_date | string | |
| coupons[].issued_center | string | |
| coupons[].expiry_date | object | |
| coupons[].redemption | string | |
| coupons[].redeemed_center | string | |
| coupons[].redeemable_by_all | string | |
| coupons[].status | string | |
| page_info | object | |
| page_info.total | integer | |
| page_info.page | integer | |
| page_info.size | integer |
Example
curl --request GET \
--url 'https://api.zenoti.com/v1/guests/{guest_id}/coupons' \
--header 'Authorization: bearer {{access_token}}'
const response = await fetch('https://api.zenoti.com/v1/guests/{guest_id}/coupons', {
method: 'GET',
headers: {
'Authorization': 'bearer {{access_token}}'
},
});
const data = await response.json();
import requests
response = requests.get(
'https://api.zenoti.com/v1/guests/{guest_id}/coupons',
headers={
'Authorization': 'bearer {{access_token}}',
},
)
data = response.json()
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "bearer {{access_token}}");
var response = await client.GetAsync(
"https://api.zenoti.com/v1/guests/{guest_id}/coupons");
var data = await response.Content.ReadAsStringAsync();
require 'net/http'
require 'json'
uri = URI('https://api.zenoti.com/v1/guests/{guest_id}/coupons')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Get.new(uri)
request['Authorization'] = 'bearer {{access_token}}'
response = http.request(request)
data = JSON.parse(response.body)
Error codes
| Status | Description |
|---|---|
| 400 | 400 |
| 401 | Unauthorized -- invalid or expired access token |
| 429 | Too many requests -- rate limit exceeded |