Skip to content

Add Capacity API methods: showBookingGrid and getActivityBookingOptions #64

@miquelgall

Description

@miquelgall

Summary

Add support for Oracle Field Service Capacity API methods to enable booking grid and activity booking options functionality.

API Methods to Implement

1. showBookingGrid

Endpoint: POST /rest/ofscCapacity/v1/showBookingGrid

Documentation: https://docs.oracle.com/en/cloud/saas/field-service/cxfsc/op-rest-ofsccapacity-v1-showbookinggrid-post.html

Purpose: Retrieves time slots in which an activity can be performed.

Request Parameters:

  • activity (object, required): Activity identification or field values
  • dateFrom (string, required): Start date (YYYY-MM-DD)
  • dateTo (string, optional): End date (defaults to dateFrom + 7 days, max +14 days)
  • identifyActivityBy (string, optional): activityId | apptNumber | apptNumberPlusCustomerNumber
  • includeResourcesDictionary (boolean, optional): Default false
  • includeTimeSlotsDictionary (boolean, optional): Default false
  • returnReasons (boolean, optional): Include reasons for unavailable slots
  • resourceFields (array, optional): Resource fields to include
  • lateStartMitigation (integer, optional): Percentage threshold (default 20)
  • forecastDuringBooking (object, optional): Activity flow forecasting settings

Response: Areas with time slots, quotas, travel times, and recommendation info.


2. getActivityBookingOptions

Endpoint: GET /rest/ofscCapacity/v1/activityBookingOptions

Documentation: https://docs.oracle.com/en/cloud/saas/field-service/cxfsc/op-rest-ofsccapacity-v1-activitybookingoptions-get.html

Purpose: Get available booking options for an activity type on specific dates.

Request Parameters:

  • activityType (string, required): Activity type for applying booking rules
  • dates (array, required): Dates to check (YYYY-MM-DD format)
  • areas (array, optional): Capacity area labels to filter
  • categories (array, optional): Capacity category labels
  • city, postalCode, stateProvince, streetAddress (optional): Address for geocoding
  • latitude, longitude (optional): Activity coordinates
  • estimateDuration, estimateTravelTime, determineCategory, determineAreaByWorkZone (boolean, optional)
  • defaultDuration (integer, optional): Fallback duration in minutes
  • minTimeBeforeArrival (integer, optional): Min minutes for day-0 bookings
  • includePartiallyDefinedCategories (boolean, optional)

Response: Duration, travel time, work zone, categories, and available time slots by date/area.

Implementation Notes

  1. These methods use the Capacity API base URL (/rest/ofscCapacity/v1/) which differs from the Core API
  2. Need to add a new base URL configuration or method for Capacity API calls
  3. Create TypeScript interfaces for request/response types
  4. Follow existing patterns in OFS.ts for method implementation

Proposed Interface Names

interface OFSShowBookingGridParams {
    activity: object;
    dateFrom: string;
    dateTo?: string;
    identifyActivityBy?: 'activityId' | 'apptNumber' | 'apptNumberPlusCustomerNumber';
    includeResourcesDictionary?: boolean;
    includeTimeSlotsDictionary?: boolean;
    returnReasons?: boolean;
    resourceFields?: string[];
    lateStartMitigation?: number;
    forecastDuringBooking?: object;
}

interface OFSGetActivityBookingOptionsParams {
    activityType: string;
    dates: string[];
    areas?: string[];
    categories?: string[];
    city?: string;
    postalCode?: string;
    stateProvince?: string;
    streetAddress?: string;
    latitude?: number;
    longitude?: number;
    estimateDuration?: boolean;
    estimateTravelTime?: boolean;
    determineCategory?: boolean;
    determineAreaByWorkZone?: boolean;
    defaultDuration?: number;
    minTimeBeforeArrival?: number;
    includePartiallyDefinedCategories?: boolean;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions