Create a Time Off
Purpose
To create a time off record.
Request URL
https://fsm.zoho.com/fsm/v1/Time_Off
Request Method
POST
Scope
scope=ZohoFSM.modules.TimeOff.CREATE
Input JSON Parameters
Name | Description | Type |
Service_Resource (mandatory) | The ID of the user for whom you want to create a time off. Use the id in the Service_Resources key present in the List Users API response. | String |
Time_Off_Type | The possible values are:
| String |
Start_Date_Time (mandatory) | If the value for Time_Off_Type is - Date: Provide the start date for the time off in the format YYYY-MM-DD - DateTime: Provide the start date and time for the time off in the ISO format YYYY-MM-DDThh:mm:ssTZD. | String or DateTime |
End_Date_Time (mandatory) | If the value for Time_Off_Type is - Date: Provide the end date for the time off in the format YYYY-MM-DD - DateTime: Provide the end date and time for the time off in the ISO format YYYY-MM-DDThh:mm:ssTZD. | String or DateTime |
Reason (mandatory) | The possible values are:
| String |
Description | This will be added to the Comments field of the time off. | String |
Sample Request
Copiedcurl --request POST 'https://fsm.zoho.com/fsm/v1/Time_Off' \
--header 'Authorization: Zoho-oauthtoken 1000.26xxxxxxxxxx.xxxxxxxxxx0' \
--header 'content-type: application/json' \
--data "{"field1":"value1","field2":"value2"}"
Sample Input
Copied{
"data": [
{
"Service_Resource": "1003000000208159",
"Time_Off_Type": "DateTime",
"Start_Date_Time": "2024-04-02T13:00:00+05:30",
"End_Date_Time": "2024-04-02T14:00:00+05:30",
"Reason": "Other work",
"Description": "Personal work"
}
]
}
Sample Success Response
Copied{
"result": "success",
"code": "SUCCESS",
"data": {
"Time_Off": [
{
"UID": "Time_Off_0",
"Modified_Time": "2024-04-02T12:39:06+05:30",
"Modified_By": {
"name": "Marianne Sheehan",
"id": "1003000000208001"
},
"Created_Time": "2024-04-02T12:39:06+05:30",
"id": "1003000001496065",
"Created_By": {
"name": "Marianne Sheehan",
"id": "1003000000208001"
},
"TabName": "TimeOff"
}
]
},
"status": "success"
}
Show full
Show less
Sample Error Response
Copied//If the Start/End Date/Time provided is after the current Date/Time.
{
"code": "TIME_OFF_DATE_ERROR",
"details": {
"Time_Off": [
{
"End_Date_Time": "2022-03-29T11:13:00+05:30",
"Description": "Personal work",
"Start_Date_Time": "2022-03-29T11:13:00+05:30",
"Reason": "Other work",
"Service_Resource": "1003000000208159",
"Time_Off_Type": "DateTime"
}
]
},
"message": "The end date and time need to exceed the start date and time.",
"status": "error"
}
//If the value provided for the Service_Resource key does not exist.
{
"code": "INVALID_SERVICE_RESOURCE",
"details": {
"Time_Off": {
"End_Date_Time": "2024-04-02T14:00:00+05:30",
"Description": "Personal work",
"Start_Date_Time": "2024-04-02T13:00:00+05:30",
"Reason": "Other work",
"Service_Resource": "1003000000208001",
"Time_Off_Type": "DateTime"
},
"Service_Resource": "1003000000208001"
},
"message": "Given Service Resource is invalid.",
"status": "error"
}
//If the user does not have the permission to create time off for other users.
{
"code": "PERMISSION_DENIED",
"details": {
"Time_Off": {
"UID": "Time_Off_0",
"code": "PERMISSION_DENIED",
"details": {
"Service_Resource": 1003000000293001
},
"message": "User Don't have access to this Service Resource.",
"status": "error"
}
},
"message": "permission denied - ",
"status": "error"
}
//If the Start/End Date/Time provided is in conflict with existing time offs of the same service resource
{
"code": "TIME_OFF_CONFLICT",
"details": {
"Time_Off": [
{
"End_Date_Time": "2024-04-02T14:00:00+05:30",
"Start_Date_Time": "2024-04-02T13:00:00+05:30",
"id": "1003000001496085",
"Reason": "Other work",
"Name": "AB-3",
"Service_Resource": {
"id": "1003000000293001"
},
"Time_Off_Type": "DateTime"
}
]
},
"message": "Conflicting Time Off records found for provided Start and End date time.",
"status": "error"
}
Show full
Show less