Retrieve the memberships associated with classes
This API helps you to retrieve the memberships that have a benefit associated with the specified class.
You must provide the appropriate details in the API request for the search_type and item_ids parameters. Optionally, you can also specify the required details in the API request for several other parameters to filter the search results in the API response. Refer to the Request Parameters table for more information.
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/classes/memberships
Base URL: https://api.zenoti.com
Request
Headers
| Header | Required | Description |
|---|---|---|
| Authorization | Yes | bearer {{access_token}} |
Query parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| search_type | enum () | Yes | — | Mandatory Item type to list membership details. You can specify any one of these values: Class = 0, Category = 1, and Center = 2. |
| page_number | integer (int32) | No | — | Optional Current page to be viewed. Returns all records if no value is specified. |
| page_size | integer (int32) | No | — | Optional Number of records to be listed per page. It returns all records if no value is specified. |
| item_ids | string[] | Yes | — | Mandatory You can specify the IDs of multiple items separated by commas: Class - int values, Category - guid values, and Center - guid values. |
Response
Success (200 OK)
{
"Error": {},
"Memberships": [
{
"...": "..."
}
],
"total": 6
}
Response fields
| Field | Type | Description |
|---|---|---|
| Error | object | |
| Memberships | object[] | |
| Memberships[].Id | string | |
| Memberships[].VersionId | string | |
| Memberships[].Name | string | |
| Memberships[].Price | object | |
| Memberships[].CanBook | boolean | |
| Memberships[].ShowPrice | boolean | |
| Memberships[].DisplayName | string | |
| Memberships[].DisplayPrice | string | |
| Memberships[].ImagePaths | object | |
| Memberships[].IsRecurrringMembership | boolean | |
| Memberships[].MembershipType | integer | |
| Memberships[].FirstCollectionAfter | integer | |
| Memberships[].Description | string | |
| Memberships[].HTMLDescription | object | |
| Memberships[].TermsandConditions | string | |
| Memberships[].TermsandConditionsAcceptance | string | |
| Memberships[].enforce_mandatory_fields | boolean | |
| Memberships[].FrequencyText | string | |
| total | integer |
Example
curl --request GET \
--url 'https://api.zenoti.com/v1/classes/memberships?search_type={{search_type}}&item_ids={{item_ids}}' \
--header 'Authorization: bearer {{access_token}}'
const response = await fetch('https://api.zenoti.com/v1/classes/memberships', {
method: 'GET',
headers: {
'Authorization': 'bearer {{access_token}}'
},
});
const data = await response.json();
import requests
response = requests.get(
'https://api.zenoti.com/v1/classes/memberships',
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/classes/memberships");
var data = await response.Content.ReadAsStringAsync();
require 'net/http'
require 'json'
uri = URI('https://api.zenoti.com/v1/classes/memberships')
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 |