Skip to main content

Create a Service Appointment

Purpose

To create a time sheet for a service appointment.

Request URL

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

Request Method

POST

Scope

scope=ZohoFSM.modules.TimeSheets.CREATE

Input JSON Parameters

NameDescriptionTypeMandatory
Service_AppointmentThe ID of the service appointment for which you are creating the time sheetStringYes
Service_Resource           The ID of the user for whom you want to create the time sheet. Use the id in the Service_Resources key present in the List Users API response.StringYes
DescriptionAny description you want to add to the time sheetString 
Start_Date_TimeThe date and time at which you want to start the time sheet. The value must be in the ISO format: YYYY-MM-DDThh:mm:ssTZDDateTimeYes
End_Date_TimeThe date and time at which you want to end the time sheet. The value must be in the ISO format: YYYY-MM-DDThh:mm:ssTZDDateTime 
Service_Line_ItemsThe IDs of the service line items in the appointment for which you want to create the time sheet. You can obtain this from the API response of Get a Service Appointment. The value that you need to use is the id in the Service_Line_Item key. Use the Service Line Item Name in the appointment to identify the service line item in the API response of Get a Service Appointment.ArrayYes, when there are no service task line items for the service
Service_Tasks_Line_ItemsThe IDs of the service task line items in the appointment for which you want to create the time sheet. You can obtain this from the API response of Get a Service Appointment. The value that you need to use is the id in the Service_Task_Line_Item key. Use the Service Task Line Item Name in the appointment to identify the service task line item in the API response of Get a Service Appointment.ArrayYes, if service tasks are present for the service.

Sample Request

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

Sample Input

Copied{
    "data": [
        {
            "Service_Appointment": "1003000002329496",
            "Service_Resource": "1003000000208159",
            "Description": "Painting: Clean and prep wall \nFlooring: Preparation",
            "Start_Date_Time": "2025-01-22T09:15:00+05:30",
            "End_Date_Time": "2025-01-22T10:00:00+05:30",
            "Service_Line_Items": [
                "1003000002329333",
                "1003000002329334"
            ],
            "Service_Tasks_Line_Items": [
                "1003000002329353",
                "1003000002329357"
            ]
        }
    ]
}

Show full

Show less

Sample Success Response

Copied{
    "result": "success",
    "code": "SUCCESS",
    "data": {
        "Time_Sheets": [
            {
                "UID": "Time_Sheets_0",
                "Modified_Time": "2025-01-22T17:41:41+05:30",
                "Modified_By": {
                    "name": "Marianne Sheehan",
                    "id": "1003000000208001"
                },
                "Created_Time": "2025-01-22T17:41:41+05:30",
                "id": "1003000002333127",
                "Created_By": {
                    "name": "Marianne Sheehan",
                    "id": "1003000000208001"
                },
                "TabName": "TimeSheets"
            }
        ],
        "Timesheet_X_Services": [
            {
                "Modified_Time": "2025-01-22T17:41:42+05:30",
                "Modified_By": {
                    "name": "Marianne Sheehan",
                    "id": "1003000000208001"
                },
                "Created_Time": "2025-01-22T17:41:42+05:30",
                "id": "1003000002333134",
                "Created_By": {
                    "name": "Marianne Sheehan",
                    "id": "1003000000208001"
                },
                "TabName": "TimesheetServicesRel"
            },
            {
                "Modified_Time": "2025-01-22T17:41:42+05:30",
                "Modified_By": {
                    "name": "Marianne Sheehan",
                    "id": "1003000000208001"
                },
                "Created_Time": "2025-01-22T17:41:42+05:30",
                "id": "1003000002333135",
                "Created_By": {
                    "name": "Marianne Sheehan",
                    "id": "1003000000208001"
                },
                "TabName": "TimesheetServicesRel"
            }
        ]
    },
    "status": "success"
}

Show full

Show less

Sample Error Response

Copied//The time sheet that you are trying to create has overlapping hours with existing time sheets
{
    "code": "CONFLICTING_TIME_SHEETS",
    "details": {
        "Time_Sheets": [
            {
                "End_Date_Time": "2025-01-23T00:30:00+05:30",
                "Start_Date_Time": "2025-01-23T00:00:00+05:30",
                "Service_Appointment": {
                    "id": "1003000002329200",
                    "Name": "AP-91"
                },
                "id": "1003000002329290",
                "Service_Resource": {
                    "id": "1003000000208159",
                    "Name": "Marianne Sheehan"
                },
                "Name": "TS73"
            },
            {
                "End_Date_Time": "2025-01-29T00:30:00+05:30",
                "Start_Date_Time": "2025-01-29T00:00:00+05:30",
                "Service_Appointment": {
                    "id": "1003000002329200",
                    "Name": "AP-91"
                },
                "id": "1003000002329400",
                "Service_Resource": {
                    "id": "1003000000208159",
                    "Name": "Marianne Sheehan"
                },
                "Name": "TS78"
            },
            {
                "End_Date_Time": "2025-01-22T17:01:25+05:30",
                "Start_Date_Time": "2025-01-22T17:01:04+05:30",
                "Service_Appointment": {
                    "id": "1003000002329200",
                    "Name": "AP-91"
                },
                "id": "1003000002329431",
                "Service_Resource": {
                    "id": "1003000000208159",
                    "Name": "Marianne Sheehan"
                },
                "Name": "TS79"
            },
            {
                "End_Date_Time": "2025-01-24T00:30:00+05:30",
                "Start_Date_Time": "2025-01-24T00:00:00+05:30",
                "Service_Appointment": {
                    "id": "1003000002329200",
                    "Name": "AP-91"
                },
                "id": "1003000002333007",
                "Service_Resource": {
                    "id": "1003000000208159",
                    "Name": "Marianne Sheehan"
                },
                "Name": "TS74"
            },
            {
                "End_Date_Time": "2025-01-25T12:29:57+05:30",
                "Start_Date_Time": "2025-01-25T11:29:57+05:30",
                "Service_Appointment": {
                    "id": "1003000002329200",
                    "Name": "AP-91"
                },
                "id": "1003000002333024",
                "Service_Resource": {
                    "id": "1003000000208159",
                    "Name": "Marianne Sheehan"
                },
                "Name": "TS75"
            },
            {
                "End_Date_Time": "2025-01-27T12:29:57+05:30",
                "Start_Date_Time": "2025-01-27T11:29:57+05:30",
                "Service_Appointment": {
                    "id": "1003000002329200",
                    "Name": "AP-91"
                },
                "id": "1003000002333042",
                "Service_Resource": {
                    "id": "1003000000208159",
                    "Name": "Marianne Sheehan"
                },
                "Name": "TS76"
            },
            {
                "End_Date_Time": "2025-01-28T12:29:57+05:30",
                "Start_Date_Time": "2025-01-28T11:29:57+05:30",
                "Service_Appointment": {
                    "id": "1003000002329200",
                    "Name": "AP-91"
                },
                "id": "1003000002333059",
                "Service_Resource": {
                    "id": "1003000000208159",
                    "Name": "Marianne Sheehan"
                },
                "Name": "TS77"
            },
            {
                "End_Date_Time": "2025-01-22T10:00:00+05:30",
                "Start_Date_Time": "2025-01-22T09:00:00+05:30",
                "Service_Appointment": {
                    "id": "1003000002329496",
                    "Name": "AP-92"
                },
                "id": "1003000002333085",
                "Service_Resource": {
                    "id": "1003000000208159",
                    "Name": "Marianne Sheehan"
                },
                "Name": "TS80"
            }
        ]
    },
    "message": "Conflicting timesheets found for provided Start, End date time.",
    "status": "error"
}

Show full

Show less

Sample Error Response

Copied//If service tasks are present for the service, then atleast one service task of the service must be included
{
 "code": "MANDATORY_KEY_NOTFOUND",
 "details": {},
 "message": "Atleast one service task must be selected.",
 "status": "error"
}

Sample Error Response

Copied//The IDs provided for Service_Line_Items/Service_Tasks_Line_Items are incorrect
{
    "code": "INVALID_LINEITEMS_IN_TIMESHEET",
    "details": {},
    "message": "Lineitems used in timesheet are not available in selected Appointment.",
    "status": "error"
}

Sample Error Response

Copied//The end date time of the time sheet should be before the start date time
{
    "code": "INVALID_DATA",
    "details": {},
    "message": "End Date Time must be after Start Date Time of Timesheet",
    "status": "error"
}