Pike13 For Developers
Get Started
Authentication
Core API
Reporting API
Webhooks API
Announcements

Core API Documentation

Event Occurrence

A scheduled instance of a Service. For example, the phrase "Group Workout from 9am-10am on 2014/09/01" could be used to describe an Event Occurrence.

Front

No authentication required.

GET /api/v2/front/event_occurrences

This returns a list of publicly viewable GroupClasses and Courses for a time range (defaulting to today). The parameters to and from can be used to specify a time range. If you are interested in building out a publicly viewable schedule of a business, this is the endpoint you need.

Parameters

fromtimestampStart of time range filter. Defaults to beginning of day, today.
totimestampEnd of time range filter. Defaults to end of day, today.
idscomma delimited stringEvent occurrence id(s) to filter on. Does not yield errors if event occurrence does not exist.
statecomma delimited string

State of the event occurrence. Multiple values can be specified when separated by a comma. For example, state=active,canceled will return Event Occurrences that are active or canceled. Possible values: active, canceled, reserved, deleted. Defaults to active.

staff_member_idscomma delimited stringThe staff member identifier(s) to filter on. Yields errors if staff member does not exist.
service_idscomma delimited stringThe service identifier(s) to filter on. Yields errors if service does not exist.
event_idscomma delimited stringThe event identifier(s) to filter on. Yields errors if event does not exist.
location_idscomma delimited stringThe location identifier(s) to filter on. Yields errors if location does not exist.

Show curl example

REQUEST
$ curl "https://mybiz.pike13.com/api/v2/front/event_occurrences?from=2014-09-12T07:00:00Z&to=2014-09-13T07:00:0Z&client_id=XXXXXXXXXXXXXX"

RESPONSE
{
  "event_occurrences": [
    {
      "id": 262,
      "event_id": 3,
      "name": "Group Workout",
      "description": "Ut omnis quibusdam porro qui laudantium maxime quidem.",
      "service_id": 1,
      "location_id": 1,
      "start_at": "2014-09-12T16:00:00Z",
      "end_at": "2014-09-12T18:00:00Z",
      "url": "http://mybiz.pike13.com/e/262",
      "timezone": "America/Los_Angeles",
      "state": "active",
      "full": false,
      "capacity_remaining": 18,
      "staff_members": [
        {
          "id": 1,
          "name": "John Staff"
        }
      ],
      "waitlist": {
        "full": false
      }
    }
  ]
}

GET /api/v2/front/event_occurrences/:id

Returns the details of an individual Event Occurrence.

Some differences from the desk version

  • Appointments are returned if the authenticated person is the enrollee.
  • People are not included with the Event Occurrences.
  • Visit data not included with the Event Occurrences.

Show curl example

REQUEST
$ curl https://mybiz.pike13.com/api/v2/front/event_occurrences/1?client_id=XXXXXXXXXXXXXX

RESPONSE
{
  "event_occurrences": [
    {
      "id": 262,
      "event_id": 3,
      "name": "Group Workout",
      "description": "Ut omnis quibusdam porro qui laudantium maxime quidem.",
      "service_id": 1,
      "location_id": 1,
      "start_at": "2014-09-12T16:00:00Z",
      "end_at": "2014-09-12T18:00:00Z",
      "url": "http://mybiz.pike13.com/e/262",
      "timezone": "America/Los_Angeles",
      "state": "active",
      "full": false,
      "capacity_remaining": 18,
      "staff_members": [
        {
          "id": 1,
          "name": "John Staff"
        }
      ],
      "waitlist": {
        "full": false
      }
    }
  ]
}

GET /api/v2/front/event_occurrences/summary

Returns a count of event occurrences by day or by hour of each day

Parameters

fromtimestampStart of time range filter. Defaults to beginning of day, today.
totimestampEnd of time range filter. Defaults to end of day, today.
group_bystring

Grouping of the counts. Possible values: day, hour. Defaults to day.

location_idscomma delimited stringThe location identifier(s) to filter on.
service_idscomma delimited stringThe service identifier(s) to filter on.
service_typescomma delimited string

The service type(s) to filter on. Possible values: Course, GroupClass. Defaults to Course,GroupClass.

staff_member_idscomma delimited stringThe staff member identifier(s) to filter on.
statecomma delimited string

State of the event occurrence. Multiple values can be specified when separated by a comma. For example, state=active,canceled will return Event Occurrences that are active or canceled. Possible values: active, canceled, reserved, deleted. Defaults to active.

Show curl example by day

REQUEST
$ curl https://mybiz.pike13.com/api/v2/front/event_occurrences/summary?client_id=XXXXXXXXXXXXXX

RESPONSE
{
  "2017-05-01": 0,
  "2017-05-02": 1
}

Show curl example by hour

REQUEST
$ curl "https://mybiz.pike13.com/api/v2/front/event_occurrences/summary?group_by=hour&client_id=XXXXXXXXXXXXXX"

RESPONSE
{
  "2017-05-01": {
    "0": 0,
    "1": 0,
    "2": 0,
    "3": 0,
    "4": 0,
    "5": 0,
    "6": 0,
    "7": 0,
    "8": 0,
    "9": 0,
    "10": 0,
    "11": 0,
    "12": 0,
    "13": 0,
    "14": 0,
    "15": 0,
    "16": 1,
    "17": 0,
    "18": 0,
    "19": 0,
    "20": 0,
    "21": 0,
    "22": 0,
    "23": 0
  },
  "2017-05-02": {
    "0": 0,
    "1": 0,
    "2": 0,
    "3": 0,
    "4": 0,
    "5": 0,
    "6": 0,
    "7": 0,
    "8": 0,
    "9": 0,
    "10": 0,
    "11": 0,
    "12": 0,
    "13": 0,
    "14": 0,
    "15": 0,
    "16": 0,
    "17": 0,
    "18": 0,
    "19": 0,
    "20": 0,
    "21": 0,
    "22": 0,
    "23": 0
  }
}

Desk

GET /api/v2/desk/event_occurrences

This returns a list of Event Occurrences for a time range (defaulting to today). The parameters to and from can be used to specify a time range.

When the business has rooms enabled, each event occurrence may include a read-only resources array of assigned rooms (with availability and capacity). Room assignment is not available through create or update on this API.

The people array has one entry per visit, with the visit's visit_id and visit_state (see Visits).

Parameters

fromtimestampStart of time range filter. Defaults to beginning of day, today.
totimestampEnd of time range filter. Defaults to end of day, today.
idscomma delimited stringEvent occurrence id(s) to filter on. Does not yield errors if event occurrence does not exist.
statecomma delimited string

State of the event occurrence. Multiple values can be specified when separated by a comma. For example, state=active,canceled will return Event Occurrences that are active or canceled. Possible values: active, canceled, reserved, deleted. Defaults to active.

staff_member_idscomma delimited stringThe staff member identifier(s) to filter on. Yields errors if staff member does not exist.
service_idscomma delimited stringThe service identifier(s) to filter on. Yields errors if service does not exist.
event_idscomma delimited stringThe event identifier(s) to filter on. Yields errors if event does not exist.
location_idscomma delimited stringThe location identifier(s) to filter on. Yields errors if location does not exist.

Show curl example

REQUEST
$ curl "https://mybiz.pike13.com/api/v2/desk/event_occurrences?from=2014-09-12T07:00:00Z&to=2014-09-13T07:00:0Z" \
  -H "Authorization: Bearer XXXXXXXXXXXXXXX"

RESPONSE
{
  "event_occurrences": [
    {
      "id": 1,
      "event_id": 1,
      "name": "Hair Cut",
      "description": "Rerum adipisci at nam quae omnis autem.",
      "service_id": 6,
      "location_id": 1,
      "start_at": "2014-09-11T09:00:00Z",
      "end_at": "2014-09-11T10:00:00Z",
      "timezone": "America/Los_Angeles",
      "attendance_complete": false,
      "state": "active",
      "full": true,
      "visits_count": 1,
      "capacity_remaining": 0,
      "staff_members": [
        {
          "id": 1,
          "name": "John Staff"
        }
      ],
      "people": [
        {
          "id": 59,
          "name": "Jane Doe",
          "email": null,
          "visit_id": 301,
          "visit_state": "completed"
        }
      ],
      "resources": [
        {
          "id": 1,
          "name": "Studio A",
          "description": "Main studio room.",
          "position": 1,
          "category_id": 2,
          "location_id": 1,
          "service_ids": [
            6
          ],
          "availability": {
            "allow_to_book": true,
            "capacity": 12,
            "room_booking_length": 60,
            "start_interval": 15,
            "before_time": 0,
            "after_time": 0,
            "show_remaining_spaces": false
          }
        }
      ]
    },
    {
      "id": 262,
      "event_id": 3,
      "name": "Group Workout",
      "description": "Ut omnis quibusdam porro qui laudantium maxime quidem.",
      "service_id": 1,
      "location_id": 1,
      "start_at": "2014-09-12T16:00:00Z",
      "end_at": "2014-09-12T18:00:00Z",
      "timezone": "America/Los_Angeles",
      "attendance_complete": false,
      "state": "active",
      "full": false,
      "visits_count": 2,
      "capacity_remaining": 18,
      "staff_members": [
        {
          "id": 1,
          "name": "John Staff"
        }
      ],
      "people": [
        {
          "id": 3,
          "name": "John Client",
          "email": "johnclient@example.com",
          "visit_id": 302,
          "visit_state": "registered"
        },
        {
          "id": 48,
          "name": "Jane Client",
          "email": "janeclient@example.com",
          "visit_id": 303,
          "visit_state": "registered"
        }
      ]
    }
  ]
}

GET /api/v2/desk/event_occurrences/:id

Returns the details of an individual Event Occurrence.

Show curl example

REQUEST
$ curl https://mybiz.pike13.com/api/v2/desk/event_occurrences/1 \
  -H "Authorization: Bearer XXXXXXXXXXXXXXX"

RESPONSE
{
  "event_occurrences": [
    {
      "id": 1,
      "event_id": 3,
      "name": "Group Workout",
      "description": "Ut omnis quibusdam porro qui laudantium maxime quidem.",
      "service_id": 1,
      "location_id": 1,
      "updating": false,
      "start_at": "2014-09-12T16:00:00Z",
      "end_at": "2014-09-12T18:00:00Z",
      "timezone": "America/Los_Angeles",
      "attendance_complete": false,
      "state": "active",
      "full": false,
      "visits_count": 2,
      "capacity_remaining": 18,
      "staff_members": [
        {
          "id": 1,
          "name": "John Staff"
        }
      ],
      "people": [
        {
          "id": 3,
          "name": "John Client",
          "email": "johnclient@example.com",
          "visit_id": 6,
          "visit_state": "completed"
        },
        {
          "id": 48,
          "name": "Jane Client",
          "email": "janeclient@example.com",
          "visit_id": 7,
          "visit_state": "completed"
        }
      ],
      "resources": [
        {
          "id": 1,
          "name": "Studio A",
          "description": "Main studio room.",
          "position": 1,
          "category_id": 2,
          "location_id": 1,
          "service_ids": [
            1
          ],
          "availability": {
            "allow_to_book": true,
            "capacity": 12,
            "room_booking_length": 60,
            "start_interval": 15,
            "before_time": 0,
            "after_time": 0,
            "show_remaining_spaces": false
          }
        }
      ],
      "visits": [
        {
          "id": 6,
          "person_id": 3,
          "status": "unpaid",
          "registered_at": "2014-09-12T20:49:43Z",
          "completed_at": "2014-09-12T20:49:43Z",
          "created_at": "2014-09-12T20:49:43Z",
          "noshow_at": null,
          "cancelled_at": null,
          "paid": false,
          "paid_for_by": null
        },
        {
          "id": 7,
          "person_id": 48,
          "status": "complete",
          "registered_at": "2014-09-17T21:18:59Z",
          "completed_at": "2014-09-17T21:18:59Z",
          "created_at": "2014-09-17T21:18:59Z",
          "noshow_at": null,
          "cancelled_at": null,
          "paid": true,
          "paid_for_by": "Group Workout"
        }
      ]
    }
  ]
}

GET /api/v2/desk/event_occurrences/summary

Returns a count of event occurrences by day or by hour of each day

Parameters

fromtimestampStart of time range filter. Defaults to beginning of day, today.
totimestampEnd of time range filter. Defaults to end of day, today.
group_bystring

Grouping of the counts. Possible values: day, hour. Defaults to day.

location_idscomma delimited stringThe location identifier(s) to filter on.
service_idscomma delimited stringThe service identifier(s) to filter on.
service_typescomma delimited string

The service type(s) to filter on. Possible values: Appointment, Course, GroupClass. Defaults to Appointment,Course,GroupClass.

staff_member_idscomma delimited stringThe staff member identifier(s) to filter on.
statecomma delimited string

State of the event occurrence. Multiple values can be specified when separated by a comma. For example, state=active,canceled will return Event Occurrences that are active or canceled. Possible values: active, canceled, reserved, deleted. Defaults to active.

Show curl example by day

REQUEST
$ curl https://mybiz.pike13.com/api/v2/desk/event_occurrences/summary \
  -H "Authorization: Bearer XXXXXXXXXXXXXXX"

RESPONSE
{
  "2017-05-01": 0,
  "2017-05-02": 1
}

Show curl example by hour

REQUEST
$ curl https://mybiz.pike13.com/api/v2/desk/event_occurrences/summary?group_by=hour \
  -H "Authorization: Bearer XXXXXXXXXXXXXXX"

RESPONSE
{
  "2017-05-01": {
    "0": 0,
    "1": 0,
    "2": 0,
    "3": 0,
    "4": 0,
    "5": 0,
    "6": 0,
    "7": 0,
    "8": 0,
    "9": 0,
    "10": 0,
    "11": 0,
    "12": 0,
    "13": 0,
    "14": 0,
    "15": 0,
    "16": 1,
    "17": 0,
    "18": 0,
    "19": 0,
    "20": 0,
    "21": 0,
    "22": 0,
    "23": 0
  },
  "2017-05-02": {
    "0": 0,
    "1": 0,
    "2": 0,
    "3": 0,
    "4": 0,
    "5": 0,
    "6": 0,
    "7": 0,
    "8": 0,
    "9": 0,
    "10": 0,
    "11": 0,
    "12": 0,
    "13": 0,
    "14": 0,
    "15": 0,
    "16": 0,
    "17": 0,
    "18": 0,
    "19": 0,
    "20": 0,
    "21": 0,
    "22": 0,
    "23": 0
  }
}

POST /api/v2/desk/event_occurrences/:id/cancel

Cancels a single event occurrence. On success the response is 201 Created. The body is empty unless issue_make_up_passes is true.

When issue_make_up_passes is true, the server attempts make-up passes for registered enrollments that can be punched (for example, when an applicable punchcard exists); enrollments that cannot be punched are skipped without failing the cancellation, and the response lists them in make_up_skipped_visits. Send make_up_reason_id and optional free_form_reason inside cancellation.make_up_attributes. Make-up issuance is not allowed when remove_from_calendar is true, and requires the business make-up feature and a service policy that allows staff-issued make-ups.

Show curl example

REQUEST
$ curl -X POST https://mybiz.pike13.com/api/v2/desk/event_occurrences/1/cancel \
  -H "Authorization: Bearer XXXXXXXXXXXXXXX" \
  -H "Content-Type: application/json" \
  -d '{
    "cancellation": {
      "remove_from_calendar": false,
      "notify_clients": true,
      "notes_attributes": { "0": { "note": "Class cancelled due to weather." } },
      "issue_make_up_passes": true,
      "make_up_attributes": {
        "make_up_reason_id": 1,
        "free_form_reason": "Weather closure"
      }
    }
  }'

RESPONSE
{
  "make_up_skipped_visits": [
    {
      "visit_id": 698542046,
      "person_id": 14400961
    }
  ]
}

Attributes (cancellation object, required)

remove_from_calendarbooleanIf true, removes the occurrence from the calendar instead of only cancelling it. Defaults to false.
notify_clientsbooleanIf true, sends client notifications; use with notes_attributes. Defaults to false.
notes_attributesobjectNested note payload when notify_clients is true (e.g. hash of index keys to { note: "..." }).
issue_make_up_passesbooleanIf true, attempts make-up passes for registered enrollments that can be punched after cancellation (others are skipped). Defaults to false.
make_up_attributesobject

Include when issue_make_up_passes is true.

make_up_reason_idintegerMake-up reason id. Required when issue_make_up_passes is true.
free_form_reasonstringOptional free-text reason.

Response attributes (when issue_make_up_passes is true)

make_up_skipped_visitsarray

Registered visits that did not get a make-up pass because they have no applicable plan or pass. Empty when every registered visit received one.

visit_idintegerVisit that was skipped.
person_idintegerPerson the visit belongs to.
POST /api/v2/desk/event_occurrences/:id/change

Changes the staff members assigned to a single event occurrence. On success the response is 204 No Content with an empty body.

Send the complete set of staff members you want assigned in organizer_ids. The set is replaced rather than merged, so a staff member you leave out is unassigned. To swap one staff member on an occupied occurrence, send the staff members you are keeping along with the new one.

Only the specified occurrence is changed, even when it belongs to a recurring event. To change a whole series, use the staff web UI.

Show curl example

REQUEST
$ curl -X POST https://mybiz.pike13.com/api/v2/desk/event_occurrences/1/change \
  -H "Authorization: Bearer XXXXXXXXXXXXXXX" \
  -H "Content-Type: application/json" \
  -d '{
    "change": {
      "notify_clients": true,
      "notify_staff_members": true,
      "new_ical_attributes": {
        "organizer_ids": [12, 34]
      }
    }
  }'

Attributes (change object, required)

notify_clientsbooleanNotifies the clients registered for the occurrence. Defaults to true, so clients are notified unless you send false.
notify_staff_membersbooleanNotifies the staff members added to and removed from the occurrence. Defaults to true, so staff members are notified unless you send false.
new_ical_attributesobject

Omit this object entirely to make no change. The request still succeeds and no change is recorded.

organizer_idsarrayThe staff member ids to assign, replacing the current set. When set to an empty array, [], or to null, removes all staff members from the occurrence.

A 422 Unprocessable Entity with an errors object is returned when the change cannot be applied. If the occurrence is already being updated, errors.base asks you to try again in a few moments, and the request can be retried.

Every staff member id you add must belong to this business and be assignable, matching the staff list the web UI offers. If any added id does not, errors.organizer_ids names the offending ids and the whole request is rejected, leaving the occurrence untouched. Ids already assigned to the occurrence are accepted as-is, so a staff member who was hidden or removed after being assigned does not block further changes.