> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # QueryAttendance # Package: bookings # Namespace: AttendanceService # Method link: https://dev.wix.com/docs/api-reference/business-solutions/bookings/bookings/attendance/query-attendance.md ## Permission Scopes: Read Bookings - Including Participants: SCOPE.DC-BOOKINGS.READ-BOOKINGS-SENSITIVE ## Introduction Retrieves up to 100 `attendance` objects, given the specified paging, filtering, and sorting. When querying attendance information, you can query from the perspective of: + **A booking.** Specify a booking ID to retrieve attendance information for all sessions related to that booking. For example, query by `bookingId` for a course booking to retrieve a participant's attendance for all course sessions. + **A session.** Specify a session ID to retrieve attendance information for all bookings related to that session. Query Attendance runs with the following defaults, which you can override: - `id` sorted in `ASC` order. - `cursorPaging.limit` set to `50`. Only a single filter is supported per query. If you define multiple filters in the same query, only the first is processed. To learn about working with query methods, see [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language). --- ## REST API ### Schema ``` Method: queryAttendance Description: Retrieves up to 100 `attendance` objects, given the specified paging, filtering, and sorting. When querying attendance information, you can query from the perspective of: + **A booking.** Specify a booking GUID to retrieve attendance information for all sessions related to that booking. For example, query by `bookingId` for a course booking to retrieve a participant's attendance for all course sessions. + **A session.** Specify a session GUID to retrieve attendance information for all bookings related to that session. Query Attendance runs with the following defaults, which you can override: - `id` sorted in `ASC` order. - `cursorPaging.limit` set to `50`. Only a single filter is supported per query. If you define multiple filters in the same query, only the first is processed. To learn about working with query methods, see [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language). URL: https://www.wixapis.com/bookings/attendance/v2/attendance/query Method: POST # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: query Method parameters: param name: query | type: QueryV2 | required: true - name: cursorPaging | type: CursorPaging | description: Cursor token pointing to a page of results. In the first request, specify `cursorPaging.limit`. For following requests, specify the retrieved `cursorPaging.cursor` token and not `query.filter` or `query.sort`. - name: limit | type: integer | description: Number of `Attendance` objects to return. Default: `50` Maximum: `1000` - name: cursor | type: string | description: Pointer to the next or previous page in the list of results. You can get the relevant cursor token from the `pagingMetadata` object in the previous call's response. Not relevant for the first request. - name: filter | type: object | description: Filter object. See [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language) for more information. Max: 1 filter - name: sort | type: array | description: Sort object in the following format: `[ {"fieldName":"sortField1","order":"ASC"}, {"fieldName":"sortField2","order":"DESC"} ]` - name: fieldName | type: string | description: Name of the field to sort by. - name: order | type: SortOrder | description: Sort order. - enum: ASC, DESC Return type: QueryAttendanceResponse - name: attendances | type: array | description: List of `attendance` objects that contain attendance information for a booked session. - name: id | type: string | description: GUID of the `attendance` object. - name: bookingId | type: string | description: Corresponding booking GUID. - name: status | type: AttendanceStatus | description: Status indicating if any participants attended the session. - enum: - NOT_SET: There is no available attendance information. - ATTENDED: At least a single participant attended the session. - NOT_ATTENDED: No participants attended the session. - name: numberOfAttendees | type: integer | description: Total number of participants that attended the session. By default, the number of attendees is set to `1`, but you can set a number to greater than `1` if multiple participants attended. Do not set to `0` to indicate that no one attended the session. Instead, set the `status` field to `NOT_ATTENDED`. Default: 1 - name: eventId | type: string | description: Corresponding [event GUID](https://dev.wix.com/docs/api-reference/business-management/calendar/events-v3/event-object.md). Use this field instead of the deprecated `sessionId`. You can retrieve the event GUID from the booking's slot `booking.bookedEntity.slot.eventId`. - name: pagingMetadata | type: CursorPagingMetadata | description: Metadata for the paged set of results. - name: cursors | type: Cursors | description: Use these cursors to paginate between results. [Read more](https://dev.wix.com/api/rest/getting-started/api-query-language#getting-started_api-query-language_cursor-paging). - name: next | type: string | description: Cursor pointing to next page in the list of results. - name: prev | type: string | description: Cursor pointing to previous page in the list of results. - name: hasNext | type: boolean | description: Indicates if there are more results after the current page. If `true`, another page of results can be retrieved. If `false`, this is the last page. ``` ### Examples ### Query attendance information by status Retrieves information about sessions that were not attended. ```curl curl -X POST \ 'https://www.wixapis.com/bookings/v2/attendance/query' \ -H 'Authorization: ' \ -d '{ "query": { "filter": { "status": "NOT_ATTENDED" } } }' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.bookings.AttendanceService.queryAttendance(query) Description: Retrieves up to 100 `attendance` objects, given the specified paging, filtering, and sorting. When querying attendance information, you can query from the perspective of: + **A booking.** Specify a booking GUID to retrieve attendance information for all sessions related to that booking. For example, query by `bookingId` for a course booking to retrieve a participant's attendance for all course sessions. + **A session.** Specify a session GUID to retrieve attendance information for all bookings related to that session. Query Attendance runs with the following defaults, which you can override: - `id` sorted in `ASC` order. - `cursorPaging.limit` set to `50`. Only a single filter is supported per query. If you define multiple filters in the same query, only the first is processed. To learn about working with query methods, see [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language). # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: query Method parameters: param name: query | type: AttendanceQuery | required: true - name: cursorPaging | type: CursorPaging | description: Cursor token pointing to a page of results. In the first request, specify `cursorPaging.limit`. For following requests, specify the retrieved `cursorPaging.cursor` token and not `query.filter` or `query.sort`. - name: limit | type: integer | description: Number of `Attendance` objects to return. Default: `50` Maximum: `1000` - name: cursor | type: string | description: Pointer to the next or previous page in the list of results. You can get the relevant cursor token from the `pagingMetadata` object in the previous call's response. Not relevant for the first request. - name: filter | type: object | description: Filter object. See [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language) for more information. Max: 1 filter - name: sort | type: array | description: Sort object in the following format: `[ {"fieldName":"sortField1","order":"ASC"}, {"fieldName":"sortField2","order":"DESC"} ]` - name: fieldName | type: string | description: Name of the field to sort by. - name: order | type: SortOrder | description: Sort order. - enum: ASC, DESC Return type: PROMISE - name: attendances | type: array | description: List of `attendance` objects that contain attendance information for a booked session. - name: _id | type: string | description: GUID of the `attendance` object. - name: bookingId | type: string | description: Corresponding booking GUID. - name: status | type: AttendanceStatus | description: Status indicating if any participants attended the session. - enum: - NOT_SET: There is no available attendance information. - ATTENDED: At least a single participant attended the session. - NOT_ATTENDED: No participants attended the session. - name: numberOfAttendees | type: integer | description: Total number of participants that attended the session. By default, the number of attendees is set to `1`, but you can set a number to greater than `1` if multiple participants attended. Do not set to `0` to indicate that no one attended the session. Instead, set the `status` field to `NOT_ATTENDED`. Default: 1 - name: eventId | type: string | description: Corresponding [event GUID](https://dev.wix.com/docs/api-reference/business-management/calendar/events-v3/event-object.md). Use this field instead of the deprecated `sessionId`. You can retrieve the event GUID from the booking's slot `booking.bookedEntity.slot.eventId`. - name: pagingMetadata | type: CursorPagingMetadata | description: Metadata for the paged set of results. - name: cursors | type: Cursors | description: Use these cursors to paginate between results. [Read more](https://dev.wix.com/api/rest/getting-started/api-query-language#getting-started_api-query-language_cursor-paging). - name: next | type: string | description: Cursor pointing to next page in the list of results. - name: prev | type: string | description: Cursor pointing to previous page in the list of results. - name: hasNext | type: boolean | description: Indicates if there are more results after the current page. If `true`, another page of results can be retrieved. If `false`, this is the last page. ``` ### Examples ### queryAttendance ```javascript import { attendance } from '@wix/bookings'; async function queryAttendance(query) { const response = await attendance.queryAttendance(query); }; ``` ### queryAttendance (with elevated permissions) ```javascript import { attendance } from '@wix/bookings'; import { auth } from '@wix/essentials'; async function myQueryAttendanceMethod(query) { const elevatedQueryAttendance = auth.elevate(attendance.queryAttendance); const response = await elevatedQueryAttendance(query); } ``` ### queryAttendance (self-hosted) Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md). ```javascript import { createClient } from '@wix/sdk'; import { attendance } from '@wix/bookings'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { attendance }, // Include the auth strategy and host as relevant }); async function queryAttendance(query) { const response = await myWixClient.attendance.queryAttendance(query); }; ``` ---