> 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 # CalculateFirstAvailableTimeSlotPerFulfillmentType # Package: onlineOrders # Namespace: OperationsService # Method link: https://dev.wix.com/docs/api-reference/business-solutions/restaurants/online-orders/operations/calculate-first-available-time-slot-per-fulfillment-type.md ## Permission Scopes: Manage Restaurants - all permissions: SCOPE.RESTAURANTS.MEGA-SCOPES ## Introduction Retrieves the first available time slot of each fulfillment type for a specified operation. The response includes a time slot with the delivery fulfillment type only if you specify a delivery address. Only fulfillment methods capable of delivering to the specified address are considered when calculating time slot availability. --- ## REST API ### Schema ``` Method: calculateFirstAvailableTimeSlotPerFulfillmentType Description: Retrieves the first available time slot of each fulfillment type for a specified operation. The response includes a time slot with the delivery fulfillment type only if you specify a delivery address. Only fulfillment methods capable of delivering to the specified address are considered when calculating time slot availability. URL: https://www.wixapis.com/restaurants-operations/v1/operations/{operationId}/first-available-time-slot-per-fulfillment-type Method: GET # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: operationId Method parameters: param name: deliveryAddress | type: Address | description: Physical address - ONE-OF: - name: streetAddress | type: StreetAddress | description: Street name and number. - name: number | type: string | description: Street number. - name: name | type: string | description: Street name. - name: apt | type: string | description: Apartment number. - name: formattedAddressLine | type: string | description: Optional address line 1 - name: addressLine | type: string | description: Main address line, usually street and number as free text. - name: country | type: string | description: Country code. - name: subdivision | type: string | description: Subdivision. Usually a state, region, prefecture, or province code, according to [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2). - name: city | type: string | description: City name. - name: postalCode | type: string | description: Zip/postal code. - name: addressLine2 | type: string | description: Free text providing more detailed address info. Usually contains Apt, Suite, and Floor. - name: formattedAddress | type: string | description: A string containing the full address of this location. - name: hint | type: string | description: Free text to help find the address. - name: geocode | type: AddressLocation | description: Coordinates of the physical address. - name: latitude | type: number | description: Address latitude. - name: longitude | type: number | description: Address longitude. - name: countryFullname | type: string | description: Country full name. - name: subdivisionFullname | type: string | description: Subdivision full name. - name: subdivisions | type: array | description: Multi-level subdivisions from top to bottom. - name: code | type: string | description: Short subdivision code. - name: name | type: string | description: Subdivision full name. param name: operationId | type: none | required: true Return type: CalculateFirstAvailableTimeSlotPerFulfillmentTypeResponse - name: timeslotsPerFulfillmentType | type: array | description: First available time slot for each fulfillment type. Each time slot is the first available time slot for the given fulfillment type. - name: timeSlot | type: TimeSlot | description: Time Slot details. - name: startTime | type: string | description: Start time and date of the time slot in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format. - name: endTime | type: string | description: End time and date of the time slot in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format. - name: orderSchedulingType | type: OrderSchedulingType | description: Order scheduling type used by the operation. - enum: - ASAP: Immediate ordering. - PREORDER: Scheduled ordering. - name: fulfillmentInfo | type: array | description: Details for each available fulfillment option in the time slot. - ONE-OF: - name: maxTime | type: integer | description: Maximum time to fulfill the order. - name: durationRange | type: DurationRange | description: Time range in which to fulfill the order. - name: minDuration | type: integer | description: Minimum duration in minutes. - name: maxDuration | type: integer | description: Maximum duration in minutes. - name: fee | type: string | description: Fee for using this fulfillment option. - name: minOrderPrice | type: string | description: Minimum order price to qualify for using this fulfillment option. - name: freeFulfillmentPriceThreshold | type: string | description: Minimum order price to qualify for free fulfillment. If the order price exceeds this amount, the `fee` is waived. - name: address | type: Address | description: Details on the address of the fulfillment. For pickup fulfillment types, this is the address to take the order from. For delivery fulfillment types, this is the address to deliver the order to. - ONE-OF: - name: streetAddress | type: StreetAddress | description: Street name and number. - name: number | type: string | description: Street number. - name: name | type: string | description: Street name. - name: apt | type: string | description: Apartment number. - name: formattedAddressLine | type: string | description: Optional address line 1 - name: addressLine | type: string | description: Main address line, usually street and number as free text. - name: country | type: string | description: Country code. - name: subdivision | type: string | description: Subdivision. Usually a state, region, prefecture, or province code, according to [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2). - name: city | type: string | description: City name. - name: postalCode | type: string | description: Zip/postal code. - name: addressLine2 | type: string | description: Free text providing more detailed address info. Usually contains Apt, Suite, and Floor. - name: formattedAddress | type: string | description: A string containing the full address of this location. - name: hint | type: string | description: Free text to help find the address. - name: geocode | type: AddressLocation | description: Coordinates of the physical address. - name: latitude | type: number | description: Address latitude. - name: longitude | type: number | description: Address longitude. - name: countryFullname | type: string | description: Country full name. - name: subdivisionFullname | type: string | description: Subdivision full name. - name: subdivisions | type: array | description: Multi-level subdivisions from top to bottom. - name: code | type: string | description: Short subdivision code. - name: name | type: string | description: Subdivision full name. - name: fulfilmentType | type: FulfillmentType | description: Fulfillment type. - 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. ``` ### Examples ### Calculate first available time slot per fulfillment type ```curl curl -X GET 'https://www.wixapis.com/restaurants-operations/v1/operations/48605ac5-53fc-49b4-96b2-87f7636f5ce0/first-available-time-slot-per-fulfillment-type' \ -H 'Authorization: ' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.onlineOrders.OperationsService.calculateFirstAvailableTimeSlotPerFulfillmentType(operationId, options) Description: Retrieves the first available time slot of each fulfillment type for a specified operation. The response includes a time slot with the delivery fulfillment type only if you specify a delivery address. Only fulfillment methods capable of delivering to the specified address are considered when calculating time slot availability. # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: operationId Method parameters: param name: operationId | type: string | description: Operation GUID. | required: true param name: options | type: CalculateFirstAvailableTimeSlotPerFulfillmentTypeOptions none - name: deliveryAddress | type: Address | description: Delivery address. The response includes a time slot with the delivery fulfillment type only if you specify a delivery address. - ONE-OF: - name: streetAddress | type: StreetAddress | description: Street name and number. - name: number | type: string | description: Street number. - name: name | type: string | description: Street name. - name: apt | type: string | description: Apartment number. - name: formattedAddressLine | type: string | description: Optional address line 1 - name: addressLine | type: string | description: Main address line, usually street and number as free text. - name: country | type: string | description: Country code. - name: subdivision | type: string | description: Subdivision. Usually a state, region, prefecture, or province code, according to [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2). - name: city | type: string | description: City name. - name: postalCode | type: string | description: Zip/postal code. - name: addressLine2 | type: string | description: Free text providing more detailed address info. Usually contains Apt, Suite, and Floor. - name: formattedAddress | type: string | description: A string containing the full address of this location. - name: hint | type: string | description: Free text to help find the address. - name: geocode | type: AddressLocation | description: Coordinates of the physical address. - name: latitude | type: number | description: Address latitude. - name: longitude | type: number | description: Address longitude. - name: countryFullname | type: string | description: Country full name. - name: subdivisionFullname | type: string | description: Subdivision full name. - name: subdivisions | type: array | description: Multi-level subdivisions from top to bottom. - name: code | type: string | description: Short subdivision code. - name: name | type: string | description: Subdivision full name. Return type: PROMISE - name: timeslotsPerFulfillmentType | type: array | description: First available time slot for each fulfillment type. Each time slot is the first available time slot for the given fulfillment type. - name: timeSlot | type: TimeSlot | description: Time Slot details. - name: startTime | type: Date | description: Start time and date of the time slot in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format. - name: endTime | type: Date | description: End time and date of the time slot in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format. - name: orderSchedulingType | type: OrderSchedulingType | description: Order scheduling type used by the operation. - enum: - ASAP: Immediate ordering. - PREORDER: Scheduled ordering. - name: fulfillmentInfo | type: array | description: Details for each available fulfillment option in the time slot. - ONE-OF: - name: maxTime | type: integer | description: Maximum time to fulfill the order. - name: durationRange | type: DurationRange | description: Time range in which to fulfill the order. - name: minDuration | type: integer | description: Minimum duration in minutes. - name: maxDuration | type: integer | description: Maximum duration in minutes. - name: fee | type: string | description: Fee for using this fulfillment option. - name: minOrderPrice | type: string | description: Minimum order price to qualify for using this fulfillment option. - name: freeFulfillmentPriceThreshold | type: string | description: Minimum order price to qualify for free fulfillment. If the order price exceeds this amount, the `fee` is waived. - name: address | type: Address | description: Details on the address of the fulfillment. For pickup fulfillment types, this is the address to take the order from. For delivery fulfillment types, this is the address to deliver the order to. - name: city | type: string | description: none - name: subdivision | type: string | description: none - name: country | type: string | description: none - name: postalCode | type: string | description: none - name: addressLine1 | type: string | description: none - name: addressLine2 | type: string | description: none - name: fulfilmentType | type: FulfillmentType | description: Fulfillment type. - 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. ``` ### Examples ### calculateFirstAvailableTimeSlotPerFulfillmentType ```javascript import { operations } from '@wix/restaurants'; async function calculateFirstAvailableTimeSlotPerFulfillmentType(operationId,options) { const response = await operations.calculateFirstAvailableTimeSlotPerFulfillmentType(operationId,options); }; ``` ### calculateFirstAvailableTimeSlotPerFulfillmentType (with elevated permissions) ```javascript import { operations } from '@wix/restaurants'; import { auth } from '@wix/essentials'; async function myCalculateFirstAvailableTimeSlotPerFulfillmentTypeMethod(operationId,options) { const elevatedCalculateFirstAvailableTimeSlotPerFulfillmentType = auth.elevate(operations.calculateFirstAvailableTimeSlotPerFulfillmentType); const response = await elevatedCalculateFirstAvailableTimeSlotPerFulfillmentType(operationId,options); } ``` ### calculateFirstAvailableTimeSlotPerFulfillmentType (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 calculateFirstAvailableTimeSlotPerFulfillmentType(operationId,options) { const response = await myWixClient.operations.calculateFirstAvailableTimeSlotPerFulfillmentType(operationId,options); }; ``` ---