Create a Service Appointment

Purpose

To insert a new service appointment record.

Request URL

https://fsm.zoho.com/fsm/v1/Service_Appointments

Request Method

POST

Scope

scope=ZohoFSM.modules.ServiceAppointments.CREATE

Input JSON Parameters

NameDescriptionTypeMandatory
SummaryA summary for the service appointmentStringYes
Scheduled_Start_Date_Time           The scheduled start date time for the appointmentStringYes
Scheduled_End_Date_TimeThe scheduled end date time for the appointmentStringYes
$Service_Line_ItemsInclude the IDs of the service line items in the work order for which you want to create an appointmentArrayYes
$Service_Tasks_Line_ItemsInclude the IDs of the service task line items in the work order for which you want to create an appointment. Mandatory if service tasks are present in the work order.Array 
TerritoryInclude the ID of the territory assigned to the work orderStringYes, if there are multiple territories in the organization
$Service_ResourcesInclude the IDs of the service resources you want to assign to the appointment. Use the id in the Service_Resources key present in the List Users API response.Array 
LeadProvide an ID from those included in the $Service_Resources key. Mandatory if you provide more than one ID for the $Service_Resources key.String 
$allow_overlappingIf the transaction setting Allow Overlapping Appointments is enabled With Warning, setting $allow_overlapping to true will create an overlapping appointment.Boolean 

Sample Request

Copiedcurl --location --request POST 'https://fsm.zoho.com/fsm/v1/Service_Appointments' \
--header 'Authorization: Zoho-oauthtoken 1000.26xxxxxxxxxx.xxxxxxxxxx0' \
--header 'content-type: application/json' \
--data "{"field1":"value1","field2":"value2"}"

Sample Input

Copied{
    "data": [
        {
            "Summary": "Sample",
            "Scheduled_Start_Date_Time": "2024-02-28T09:00:00-05:00",
            "Scheduled_End_Date_Time": "2024-02-28T10:00:00-05:00",
            "Territory": "6191000000227288",
            "$Service_Tasks_Line_Items": [
                "6191000000425243"
            ],
            "$Service_Line_Items": [
                "6191000000425238"
            ],
            "$Service_Resources": [
                "6191000000227293",
                "6191000000299042"
            ],
            "Lead": "6191000000227293",
            "$allow_overlapping": false
        }
    ]
}

Sample Success Response

Copied{
    "result": "success",
    "code": "SUCCESS",
    "data": [
        {
            "UID": "Service_Appointments_0",
            "Modified_Time": "2024-02-26T05:05:24-05:00",
            "Modified_By": {
                "name": "Alicia Florrick",
                "id": "6191000000227001"
            },
            "Created_Time": "2024-02-26T05:05:24-05:00",
            "id": "6191000000426111",
            "Created_By": {
                "name": "Alicia Florrick",
                "id": "6191000000227001"
            },
            "TabName": "ServiceAppointments"
        }
    ],
    "status": "success"
}

Sample Error Response

Copied{
    "code": "SERVICE_RESOURCE_NOT_AVAILABLE",
    "details": {
        "availability_check": [
            {
                "Time_Off": [],
                "Service_Appointments": [],
                "Crew_Members": [],
                "is_available": false
            },
            {
                "Time_Off": [],
                "Service_Appointments": [],
                "Crew_Members": [],
                "is_available": false
            }
        ]
    },
    "message": "Service Resource is not available",
    "status": "error"
}