Customer Event Vouchers API Documentation

Overview

This sub-collection contains a customer account's event vouchers, which may be redeemed for an event reservation (this is only relevant for events which change a reservation fee).

Fields

Name Type Restrictions Required? Description
id integer Automatic Automatic The unique identifier of the event voucher. This is placed in the URL when making API calls for the event voucher.
url string Automatic Automatic The unique API URL of the event voucher.
event_type_id integer Must be the ID of an event type. May not be changed after creation. Yes The event type for which the voucher may be redeemed.
event_type_url string Automatic Automatic The API URL of the voucher's event type.
event_type_name string Automatic Automatic The name of the voucher's event type.
number_of_uses_total integer Must be greater than or equal to 1. May not be changed after creation. Yes The total number of times this voucher may be used.
number_of_uses_remaining integer Automatic Automatic The number of uses remaining on this voucher.
expiry_date string (ISO-8601 date) Must be an ISO-8601 date string, or null. No The last day that the voucher may be used. The voucher may be used until the end of this day, in the time zone of the gym. If this not set then the voucher does not expire.
expiry_date_str string Automatic Automatic The expiry date of the voucher as a human-readable string.
is_expired boolean Automatic Automatic Whether the voucher has expired.
is_removed booelan None No Whether the voucher has been removed. Set this to true instead of deleting the voucher.
created_by_id integer Automatic Automatic The database ID of the gym staff user who created this voucher.
created_by_email string Automatic Automatic The email of the gym staff user who created this voucher.
date_added_str string Automatic Automatic The date the voucher was created, as a human-readable string in the time zone of the gym.
created_at string (ISO-8601 datetime) Automatic Automatic When the event voucher was added to the Capitan database.
updated_at string (ISO-8601 datetime) Automatic Automatic When the event voucher's record in the Capitan database was last updated.

Operations

List

Request
GET /api/customers/35/event-vouchers/

Response
200 OK
{
    "count": 2,
    "next": null,
    "previous": null,
    "results": [
        {
            "id": 421,
            "url": "https://api.hellocapitan.com/api/customers/35/event-vouchers/421/",
            "event_type_id": 37,
            ...
        },
        ...
    ]
}

Read

Request
GET /api/customers/35/event-vouchers/421/

Response
200 OK
{
    "id": 35,
    "url": "https://api.hellocapitan.com/api/customers/35/event-vouchers/421/",
    "event_type_id": 37,
    ...
}

Create

Request
POST /api/customers/35/event-vouchers/
{
    "event_type_id": 42,
    "number_of_uses_total": 3
}

Response
201 Created
{
    "id": 713,
    "url": "https://api.hellocapitan.com/api/customers/35/event-vouchers/713/",
    "event_type_id": 42,
    ...
}

Replace

Request
PUT /api/customers/35/event-vouchers/713/
{
    "event_type_id": 42,
    "is_removed": true
}

Response
200 OK
{
    "id": 713,
    "url": "https://api.hellocapitan.com/api/customers/35/event-vouchers/713/",
    "event_type_id": 42,
    ...
}

Update

Request
PATCH /api/customers/35/event-vouchers/713/
{
    "is_removed": true
}

Response
200 OK
{
    "id": 713,
    "url": "https://api.hellocapitan.com/api/customers/35/event-vouchers/713/",
    "event_type_id": 42,
    ...
}