> 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 # QueryOperation # Package: onlineOrders # Namespace: OperationsService # Method link: https://dev.wix.com/docs/api-reference/business-solutions/restaurants/online-orders/operations/query-operation.md ## Permission Scopes: Manage Restaurants - all permissions: SCOPE.RESTAURANTS.MEGA-SCOPES ## Introduction Retrieves a list of operations, given the provided paging, filtering, and sorting. Query Operation runs with these defaults, which you can override: - `paging.limit` is `50` - `sort.order` is `ASC` To learn about working with _Query_ endpoints, see [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language), [Sorting and Paging](https://dev.wix.com/docs/rest/articles/getting-started/sorting-and-paging.md), and [Field Projection](https://dev.wix.com/api/rest/getting-started/field-projection). --- ## REST API ### Schema ``` Method: queryOperation Description: Retrieves a list of operations, given the provided paging, filtering, and sorting. Query Operation runs with these defaults, which you can override: - `paging.limit` is `50` - `sort.order` is `ASC` To learn about working with _Query_ endpoints, see [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language), [Sorting and Paging](https://dev.wix.com/docs/rest/articles/getting-started/sorting-and-paging.md), and [Field Projection](https://dev.wix.com/api/rest/getting-started/field-projection). URL: https://www.wixapis.com/restaurants-operations/v1/operations/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: CursorQuery | required: true - name: cursorPaging | type: CursorPaging | description: Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. - name: limit | type: integer | description: Maximum number of items to return in the results. - name: cursor | type: string | description: Pointer to the next or previous page in the list of results. Pass 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. - name: sort | type: array | description: Sort object. - name: fieldName | type: string | description: Supported properties: - `id` - `createdDate` - `updatedDate` - `name` - name: order | type: SortOrder | description: Sort order. Use `ASC` for ascending order or `DESC` for descending order.
Default: `ASC` - enum: ASC, DESC Return type: QueryOperationResponse - name: operations | type: array | description: Retrieved operations. - ONE-OF: - name: pausedUntilOptions | type: OnlineOrderingPausedUntilOptions | description: Options for online ordering status. Required when `onlineOrderingStatus` is `PAUSED_UNTIL`. - name: time | type: string | description: Date and time until which online ordering is paused.
Before the specified time, behavior is the same as when `onlineOrderingStatus` is `DISABLED`.
After the specified time, behavior is the same as when `onlineOrderingStatus` is `ENABLED`.
Passing the time does not trigger any changes to value of any properties. - name: id | type: string | description: Operation GUID. - name: revision | type: string | description: Revision number. Increments by 1 each time the operation is updated. To prevent conflicting changes, the existing `revision` must be specified when updating an operation. - name: createdDate | type: string | description: Date and time the operation was created. - name: updatedDate | type: string | description: Date and time the operation was updated. - name: name | type: string | description: Operation name. - name: default | type: boolean | description: Whether the operation is the default operation.
Default: `false`. - name: fulfillmentIds | type: array | description: IDs of the fulfillment methods ([SDK](https://dev.wix.com/docs/sdk/backend-modules/restaurants/wix-restaurants-new/fulfillment-methods/introduction.md) | [REST](https://dev.wix.com/docs/rest/api-reference/wix-restaurants/fulfillment-methods/introduction.md)) associated with the operation. - name: onlineOrderingStatus | type: OnlineOrderingStatusType | description: Online ordering status of the operation.
- enum: - UNDEFINED_ONLINE_ORDERING_STATUS: Online ordering status is not defined. - ENABLED: Operation currently accepts online orders. - DISABLED: Operation currently does not accept online orders. - PAUSED_UNTIL: Operation currently does not accept online orders, but will accept online orders from a specified time and date. When applied, `pausedUntilOptions` is a required field. - name: defaultFulfillmentType | type: FulfillmentType | description: Default fulfillment type of the operation. - enum: - PICKUP: Pickup fulfillment. The customer picks up the order from the restaurant. - DELIVERY: Delivery fulfillment. The restaurant, or a representative, delivers the order to the customer. - name: orderScheduling | type: OrderScheduling | description: Information about when an order can be placed for. - ONE-OF: - name: asapOptions | type: AsapOrderScheduling | description: Options for scheduling. Required if `type` is `ASAP`. - ONE-OF: - name: businessDaysAheadHandlingOptions | type: BusinessDaysAheadHandling | description: Options for future handling. Required when `asapFutureHandlingType` is `BUSINESS_DAYS_AHEAD_HANDLING`. - name: daysCount | type: integer | description: Number of business days ahead for which orders can be scheduled.
Setting the `daysCount` to 0 means that orders can be scheduled until the end of the current business day. - name: preparationTime | type: PreparationTime | description: Amount of time needed to prepare the order.
- When `MAX_TIME`, `maxTimeOptions` is a required field. - When `MAX_RANGE`, `timeRangeOptions` is a required field. - ONE-OF: - name: maxTimeOptions | type: TimeDuration | description: Options for preparation time. Required when `type` is `MAX_TIME`. - name: timeUnit | type: TimeUnit | description: Unit of time for the duration. - enum: - MINUTES: Minutes time unit. - HOURS: Hours time unit. - DAYS: Days time unit. - name: duration | type: integer | description: Duration value. Unit of time specified in `timeUnit`. - name: timeRangeOptions | type: TimeDurationRange | description: Options for preparation time. Required when `type` is `TIME_RANGE`. - name: timeUnit | type: TimeUnit | description: Time unit for the time range. - name: minDuration | type: integer | description: Minimum duration value. Unit of time specified in `timeUnit`. - name: maxDuration | type: integer | description: Maximum duration value. Unit of time specified in `timeUnit`. - name: type | type: PreparationTimeType | description: Preparation time type. - enum: MAX_TIME, TIME_RANGE - name: asapFutureHandlingType | type: AsapFutureHandlingType | description: Defines if and how non-immediate orders should be handled.
When this value is `BUSINESS_DAYS_AHEAD_HANDLING`, `businessDaysAheadHandlingOptions` is a required field. - enum: - NO_FUTURE_HANDLING: No future handling. - BUSINESS_DAYS_AHEAD_HANDLING: Allows future orders for up to a specified number of business days ahead. - name: preorderOptions | type: PreorderScheduling | description: Options for scheduling. Required if `type` is `PREORDER`. - name: method | type: PreorderMethod | description: - ONE-OF: - name: timeBoundedOptions | type: TimeBounded | description: Options for the method. Required when `type` is `TIME_BOUNDED`. - name: minTimeInAdvance | type: TimeDuration | description: Minimum time required to schedule the order. - name: maxTimeInAdvance | type: TimeDuration | description: Maximum time allowed to schedule the order. - name: weeklyScheduleOptions | type: WeeklySchedule | description: Options for the method. Required when `type` is `WEEKLY_SCHEDULE`. - name: cutOffTime | type: DayAndTime | description: The weekly schedule cutoff time.
Orders placed before the cutoff time are scheduled for the current week.
Orders placed after the cutoff time are scheduled for the next week. - name: dayOfWeek | type: DayOfWeek | description: Day of the week. - enum: - MON: Monday. - TUE: Tuesday. - WED: Wednesday. - THU: Thursday. - FRI: Friday. - SAT: Saturday. - SUN: Sunday. - name: timeOfDay | type: TimeOfDay | description: Time of the day. - name: hours | type: integer | description: Hours.
Min: `0`.
Max: `23`. - name: minutes | type: integer | description: Minutes.
Min: `0`.
Max: `23`. - name: type | type: MethodType | description: Type of time frame for how long in advance preorders can be made.
- When `TIME_BOUNDED`, `timeBoundedOptions` is a required field. - When `WEEKLY_SCHEDULE`, `weeklyScheduleOptions` is a required field. - enum: - TIME_BOUNDED: Preorder time has a minimum and a maximum. - WEEKLY_SCHEDULE: Preorders have a weekly schedule with a weekly cutoff time. - name: fulfillmentTimesDisplay | type: FulfillmentTimesDisplayConfig | description: Configuration of the fulfillment times.
Currently, only `TIME_WINDOWS` is supported. - ONE-OF: - name: timeWindowsOptions | type: TimeDuration | description: Options for fulfillment time. Required when `fulfillmentTimesType` is `TIME_WINDOWS`. - name: type | type: FulfillmentTimesType | description: Type of the fulfillment times.
When `TIME_WINDOWS`, `timeWindowsOptions` is a required field. - enum: - TIME_WINDOWS: Display fulfillment times as time windows. - name: type | type: SchedulingType | description: Scheduling type.
- When `ASAP`, `asapOptions` is a required field. - When `PREORDER`, `preorderOptions` is a required field. - enum: - ASAP: Orders can be scheduled for the future and to be handled immediately. - PREORDER: Orders can be scheduled only for the future. - name: operationGroupId | type: string | description: GUID of the operation group this operation belongs to. - name: businessLocationId | type: string | description: GUID of the business location ([SDK](https://dev.wix.com/docs/sdk/backend-modules/restaurants/wix-restaurants-new/about-business-locations.md) | [REST](https://dev.wix.com/docs/rest/business-solutions/restaurants/wix-restaurants-new/about-business-locations.md)) of this operation. - name: extendedFields | type: ExtendedFields | description: Extended fields. - name: namespaces | type: object | description: Extended field data. Each key corresponds to the namespace of the app that created the extended fields. The value of each key is structured according to the schema defined when the extended fields were configured. You can only access fields for which you have the appropriate permissions. Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields.md). - name: tags | type: Tags | description: Tags ([SDK](https://dev.wix.com/docs/sdk/backend-modules/tags/tags/introduction.md) | [REST](https://dev.wix.com/docs/rest/business-management/tags/introduction.md)) used to classify and sort different types of operations. - name: privateTags | type: TagList | description: Tags that require an additional permission in order to access them, normally not given to site members or visitors. - name: tagIds | type: array | description: List of tag GUIDs - name: tags | type: TagList | description: Tags that are exposed to anyone who has access to the labeled entity itself, including site members and visitors. - name: pagingMetadata | type: CursorPagingMetadata | description: Metadata of the paginated results. - name: count | type: integer | description: Number of items returned in the response. - name: cursors | type: Cursors | description: Cursor strings that point to the next page, previous page, or both. - name: next | type: string | description: Cursor string pointing to the next page in the list of results. - name: prev | type: string | description: Cursor pointing to the previous page in the list of results. - name: hasNext | type: boolean | description: Whether there are more pages to retrieve following the current page. + `true`: Another page of results can be retrieved. + `false`: This is the last page. ``` ### Examples ### QueryOperation ```curl ~~~cURL curl -X POST https://www.wixapis.com/restaurants-operations/v1/operations/query \ -H 'Content-Type: application/json' \ -H 'Authorization: ' \ --data-raw '{ "query": { "sort": [], "filter": { "name": { "$startsWith": "ASAP" } } } }' ~~~ ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.onlineOrders.OperationsService.queryOperation(query) Description: Retrieves a list of operations, given the provided paging, filtering, and sorting. Query Operation runs with these defaults, which you can override: - `paging.limit` is `50` - `sort.order` is `ASC` To learn about working with _Query_ endpoints, see [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language), [Sorting and Paging](https://dev.wix.com/docs/rest/articles/getting-started/sorting-and-paging.md), and [Field Projection](https://dev.wix.com/api/rest/getting-started/field-projection). # 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: OperationQuery | required: true - name: cursorPaging | type: CursorPaging | description: Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. - name: limit | type: integer | description: Maximum number of items to return in the results. - name: cursor | type: string | description: Pointer to the next or previous page in the list of results. Pass 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. - name: sort | type: array | description: Sort object. - name: fieldName | type: string | description: Supported properties: - `id` - `createdDate` - `updatedDate` - `name` - name: order | type: SortOrder | description: Sort order. Use `ASC` for ascending order or `DESC` for descending order.
Default: `ASC` - enum: ASC, DESC Return type: PROMISE - name: operations | type: array | description: Retrieved operations. - ONE-OF: - name: pausedUntilOptions | type: OnlineOrderingPausedUntilOptions | description: Options for online ordering status. Required when `onlineOrderingStatus` is `PAUSED_UNTIL`. - name: time | type: Date | description: Date and time until which online ordering is paused.
Before the specified time, behavior is the same as when `onlineOrderingStatus` is `DISABLED`.
After the specified time, behavior is the same as when `onlineOrderingStatus` is `ENABLED`.
Passing the time does not trigger any changes to value of any properties. - name: _id | type: string | description: Operation GUID. - name: revision | type: string | description: Revision number. Increments by 1 each time the operation is updated. To prevent conflicting changes, the existing `revision` must be specified when updating an operation. - name: _createdDate | type: Date | description: Date and time the operation was created. - name: _updatedDate | type: Date | description: Date and time the operation was updated. - name: name | type: string | description: Operation name. - name: default | type: boolean | description: Whether the operation is the default operation.
Default: `false`. - name: fulfillmentIds | type: array | description: IDs of the fulfillment methods ([SDK](https://dev.wix.com/docs/sdk/backend-modules/restaurants/wix-restaurants-new/fulfillment-methods/introduction.md) | [REST](https://dev.wix.com/docs/rest/api-reference/wix-restaurants/fulfillment-methods/introduction.md)) associated with the operation. - name: onlineOrderingStatus | type: OnlineOrderingStatusType | description: Online ordering status of the operation.
- enum: - UNDEFINED_ONLINE_ORDERING_STATUS: Online ordering status is not defined. - ENABLED: Operation currently accepts online orders. - DISABLED: Operation currently does not accept online orders. - PAUSED_UNTIL: Operation currently does not accept online orders, but will accept online orders from a specified time and date. When applied, `pausedUntilOptions` is a required field. - name: defaultFulfillmentType | type: FulfillmentType | description: Default fulfillment type of the operation. - enum: - PICKUP: Pickup fulfillment. The customer picks up the order from the restaurant. - DELIVERY: Delivery fulfillment. The restaurant, or a representative, delivers the order to the customer. - name: orderScheduling | type: OrderScheduling | description: Information about when an order can be placed for. - ONE-OF: - name: asapOptions | type: AsapOrderScheduling | description: Options for scheduling. Required if `type` is `ASAP`. - ONE-OF: - name: businessDaysAheadHandlingOptions | type: BusinessDaysAheadHandling | description: Options for future handling. Required when `asapFutureHandlingType` is `BUSINESS_DAYS_AHEAD_HANDLING`. - name: daysCount | type: integer | description: Number of business days ahead for which orders can be scheduled.
Setting the `daysCount` to 0 means that orders can be scheduled until the end of the current business day. - name: preparationTime | type: PreparationTime | description: Amount of time needed to prepare the order.
- When `MAX_TIME`, `maxTimeOptions` is a required field. - When `MAX_RANGE`, `timeRangeOptions` is a required field. - ONE-OF: - name: maxTimeOptions | type: TimeDuration | description: Options for preparation time. Required when `type` is `MAX_TIME`. - name: timeUnit | type: TimeUnit | description: Unit of time for the duration. - enum: - MINUTES: Minutes time unit. - HOURS: Hours time unit. - DAYS: Days time unit. - name: duration | type: integer | description: Duration value. Unit of time specified in `timeUnit`. - name: timeRangeOptions | type: TimeDurationRange | description: Options for preparation time. Required when `type` is `TIME_RANGE`. - name: timeUnit | type: TimeUnit | description: Time unit for the time range. - name: minDuration | type: integer | description: Minimum duration value. Unit of time specified in `timeUnit`. - name: maxDuration | type: integer | description: Maximum duration value. Unit of time specified in `timeUnit`. - name: type | type: PreparationTimeType | description: Preparation time type. - enum: MAX_TIME, TIME_RANGE - name: asapFutureHandlingType | type: AsapFutureHandlingType | description: Defines if and how non-immediate orders should be handled.
When this value is `BUSINESS_DAYS_AHEAD_HANDLING`, `businessDaysAheadHandlingOptions` is a required field. - enum: - NO_FUTURE_HANDLING: No future handling. - BUSINESS_DAYS_AHEAD_HANDLING: Allows future orders for up to a specified number of business days ahead. - name: preorderOptions | type: PreorderScheduling | description: Options for scheduling. Required if `type` is `PREORDER`. - name: method | type: PreorderMethod | description: - ONE-OF: - name: timeBoundedOptions | type: TimeBounded | description: Options for the method. Required when `type` is `TIME_BOUNDED`. - name: minTimeInAdvance | type: TimeDuration | description: Minimum time required to schedule the order. - name: maxTimeInAdvance | type: TimeDuration | description: Maximum time allowed to schedule the order. - name: weeklyScheduleOptions | type: WeeklySchedule | description: Options for the method. Required when `type` is `WEEKLY_SCHEDULE`. - name: cutOffTime | type: DayAndTime | description: The weekly schedule cutoff time.
Orders placed before the cutoff time are scheduled for the current week.
Orders placed after the cutoff time are scheduled for the next week. - name: dayOfWeek | type: DayOfWeek | description: Day of the week. - enum: - MON: Monday. - TUE: Tuesday. - WED: Wednesday. - THU: Thursday. - FRI: Friday. - SAT: Saturday. - SUN: Sunday. - name: timeOfDay | type: TimeOfDay | description: Time of the day. - name: hours | type: integer | description: Hours.
Min: `0`.
Max: `23`. - name: minutes | type: integer | description: Minutes.
Min: `0`.
Max: `23`. - name: type | type: MethodType | description: Type of time frame for how long in advance preorders can be made.
- When `TIME_BOUNDED`, `timeBoundedOptions` is a required field. - When `WEEKLY_SCHEDULE`, `weeklyScheduleOptions` is a required field. - enum: - TIME_BOUNDED: Preorder time has a minimum and a maximum. - WEEKLY_SCHEDULE: Preorders have a weekly schedule with a weekly cutoff time. - name: fulfillmentTimesDisplay | type: FulfillmentTimesDisplayConfig | description: Configuration of the fulfillment times.
Currently, only `TIME_WINDOWS` is supported. - ONE-OF: - name: timeWindowsOptions | type: TimeDuration | description: Options for fulfillment time. Required when `fulfillmentTimesType` is `TIME_WINDOWS`. - name: type | type: FulfillmentTimesType | description: Type of the fulfillment times.
When `TIME_WINDOWS`, `timeWindowsOptions` is a required field. - enum: - TIME_WINDOWS: Display fulfillment times as time windows. - name: type | type: SchedulingType | description: Scheduling type.
- When `ASAP`, `asapOptions` is a required field. - When `PREORDER`, `preorderOptions` is a required field. - enum: - ASAP: Orders can be scheduled for the future and to be handled immediately. - PREORDER: Orders can be scheduled only for the future. - name: operationGroupId | type: string | description: GUID of the operation group this operation belongs to. - name: businessLocationId | type: string | description: GUID of the business location ([SDK](https://dev.wix.com/docs/sdk/backend-modules/restaurants/wix-restaurants-new/about-business-locations.md) | [REST](https://dev.wix.com/docs/rest/business-solutions/restaurants/wix-restaurants-new/about-business-locations.md)) of this operation. - name: extendedFields | type: ExtendedFields | description: Extended fields. - name: namespaces | type: object | description: Extended field data. Each key corresponds to the namespace of the app that created the extended fields. The value of each key is structured according to the schema defined when the extended fields were configured. You can only access fields for which you have the appropriate permissions. Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields.md). - name: tags | type: Tags | description: Tags ([SDK](https://dev.wix.com/docs/sdk/backend-modules/tags/tags/introduction.md) | [REST](https://dev.wix.com/docs/rest/business-management/tags/introduction.md)) used to classify and sort different types of operations. - name: privateTags | type: TagList | description: Tags that require an additional permission in order to access them, normally not given to site members or visitors. - name: tagIds | type: array | description: List of tag GUIDs - name: tags | type: TagList | description: Tags that are exposed to anyone who has access to the labeled entity itself, including site members and visitors. - name: pagingMetadata | type: CursorPagingMetadata | description: Metadata of the paginated results. - name: count | type: integer | description: Number of items returned in the response. - name: cursors | type: Cursors | description: Cursor strings that point to the next page, previous page, or both. - name: next | type: string | description: Cursor string pointing to the next page in the list of results. - name: prev | type: string | description: Cursor pointing to the previous page in the list of results. - name: hasNext | type: boolean | description: Whether there are more pages to retrieve following the current page. + `true`: Another page of results can be retrieved. + `false`: This is the last page. ``` ### Examples ### queryOperation ```javascript import { operations } from '@wix/restaurants'; async function queryOperation(query) { const response = await operations.queryOperation(query); }; ``` ### queryOperation (with elevated permissions) ```javascript import { operations } from '@wix/restaurants'; import { auth } from '@wix/essentials'; async function myQueryOperationMethod(query) { const elevatedQueryOperation = auth.elevate(operations.queryOperation); const response = await elevatedQueryOperation(query); } ``` ### queryOperation (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 { operations } from '@wix/restaurants'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { operations }, // Include the auth strategy and host as relevant }); async function queryOperation(query) { const response = await myWixClient.operations.queryOperation(query); }; ``` ---