curl --request POST \
--url http://localhost:3000/v2/absences/ \
--header 'Content-Type: application/json' \
--header 'x-API-Key: <api-key>' \
--data '
{
"_id": "<string>",
"number": 123,
"companyId": "<string>",
"status": {
"status": 123,
"createdAt": "2023-11-07T05:31:56Z",
"createdBy": "<string>",
"lastModifiedAt": "2023-11-07T05:31:56Z",
"lastModifiedBy": "<string>"
},
"chatId": "<string>",
"userId": "<string>",
"type": 123,
"payTypeAbsenceId": "<string>",
"calculationType": "<string>",
"desc": "<string>",
"dtStart": "2023-11-07T05:31:56Z",
"dtEnd": "2023-11-07T05:31:56Z",
"daysAbsent": 123,
"fullDay": true,
"approvedBy": "<string>",
"declinedBy": "<string>",
"affectedJobs": [
"<string>"
],
"isAssigned": true,
"attachments": [
"<string>"
],
"imageIds": [
"<string>"
],
"objectManagerIds": [
"<string>"
],
"declineComment": "<string>",
"sendEmailToCustomer": true,
"affectedObjectIds": [
"<string>"
],
"absencePaidTimeArray": [
{}
],
"replacements": [
{}
]
}
'import requests
url = "http://localhost:3000/v2/absences/"
payload = {
"_id": "<string>",
"number": 123,
"companyId": "<string>",
"status": {
"status": 123,
"createdAt": "2023-11-07T05:31:56Z",
"createdBy": "<string>",
"lastModifiedAt": "2023-11-07T05:31:56Z",
"lastModifiedBy": "<string>"
},
"chatId": "<string>",
"userId": "<string>",
"type": 123,
"payTypeAbsenceId": "<string>",
"calculationType": "<string>",
"desc": "<string>",
"dtStart": "2023-11-07T05:31:56Z",
"dtEnd": "2023-11-07T05:31:56Z",
"daysAbsent": 123,
"fullDay": True,
"approvedBy": "<string>",
"declinedBy": "<string>",
"affectedJobs": ["<string>"],
"isAssigned": True,
"attachments": ["<string>"],
"imageIds": ["<string>"],
"objectManagerIds": ["<string>"],
"declineComment": "<string>",
"sendEmailToCustomer": True,
"affectedObjectIds": ["<string>"],
"absencePaidTimeArray": [{}],
"replacements": [{}]
}
headers = {
"x-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
_id: '<string>',
number: 123,
companyId: '<string>',
status: {
status: 123,
createdAt: '2023-11-07T05:31:56Z',
createdBy: '<string>',
lastModifiedAt: '2023-11-07T05:31:56Z',
lastModifiedBy: '<string>'
},
chatId: '<string>',
userId: '<string>',
type: 123,
payTypeAbsenceId: '<string>',
calculationType: '<string>',
desc: '<string>',
dtStart: '2023-11-07T05:31:56Z',
dtEnd: '2023-11-07T05:31:56Z',
daysAbsent: 123,
fullDay: true,
approvedBy: '<string>',
declinedBy: '<string>',
affectedJobs: ['<string>'],
isAssigned: true,
attachments: ['<string>'],
imageIds: ['<string>'],
objectManagerIds: ['<string>'],
declineComment: '<string>',
sendEmailToCustomer: true,
affectedObjectIds: ['<string>'],
absencePaidTimeArray: [{}],
replacements: [{}]
})
};
fetch('http://localhost:3000/v2/absences/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "3000",
CURLOPT_URL => "http://localhost:3000/v2/absences/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'_id' => '<string>',
'number' => 123,
'companyId' => '<string>',
'status' => [
'status' => 123,
'createdAt' => '2023-11-07T05:31:56Z',
'createdBy' => '<string>',
'lastModifiedAt' => '2023-11-07T05:31:56Z',
'lastModifiedBy' => '<string>'
],
'chatId' => '<string>',
'userId' => '<string>',
'type' => 123,
'payTypeAbsenceId' => '<string>',
'calculationType' => '<string>',
'desc' => '<string>',
'dtStart' => '2023-11-07T05:31:56Z',
'dtEnd' => '2023-11-07T05:31:56Z',
'daysAbsent' => 123,
'fullDay' => true,
'approvedBy' => '<string>',
'declinedBy' => '<string>',
'affectedJobs' => [
'<string>'
],
'isAssigned' => true,
'attachments' => [
'<string>'
],
'imageIds' => [
'<string>'
],
'objectManagerIds' => [
'<string>'
],
'declineComment' => '<string>',
'sendEmailToCustomer' => true,
'affectedObjectIds' => [
'<string>'
],
'absencePaidTimeArray' => [
[
]
],
'replacements' => [
[
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://localhost:3000/v2/absences/"
payload := strings.NewReader("{\n \"_id\": \"<string>\",\n \"number\": 123,\n \"companyId\": \"<string>\",\n \"status\": {\n \"status\": 123,\n \"createdAt\": \"2023-11-07T05:31:56Z\",\n \"createdBy\": \"<string>\",\n \"lastModifiedAt\": \"2023-11-07T05:31:56Z\",\n \"lastModifiedBy\": \"<string>\"\n },\n \"chatId\": \"<string>\",\n \"userId\": \"<string>\",\n \"type\": 123,\n \"payTypeAbsenceId\": \"<string>\",\n \"calculationType\": \"<string>\",\n \"desc\": \"<string>\",\n \"dtStart\": \"2023-11-07T05:31:56Z\",\n \"dtEnd\": \"2023-11-07T05:31:56Z\",\n \"daysAbsent\": 123,\n \"fullDay\": true,\n \"approvedBy\": \"<string>\",\n \"declinedBy\": \"<string>\",\n \"affectedJobs\": [\n \"<string>\"\n ],\n \"isAssigned\": true,\n \"attachments\": [\n \"<string>\"\n ],\n \"imageIds\": [\n \"<string>\"\n ],\n \"objectManagerIds\": [\n \"<string>\"\n ],\n \"declineComment\": \"<string>\",\n \"sendEmailToCustomer\": true,\n \"affectedObjectIds\": [\n \"<string>\"\n ],\n \"absencePaidTimeArray\": [\n {}\n ],\n \"replacements\": [\n {}\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://localhost:3000/v2/absences/")
.header("x-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"_id\": \"<string>\",\n \"number\": 123,\n \"companyId\": \"<string>\",\n \"status\": {\n \"status\": 123,\n \"createdAt\": \"2023-11-07T05:31:56Z\",\n \"createdBy\": \"<string>\",\n \"lastModifiedAt\": \"2023-11-07T05:31:56Z\",\n \"lastModifiedBy\": \"<string>\"\n },\n \"chatId\": \"<string>\",\n \"userId\": \"<string>\",\n \"type\": 123,\n \"payTypeAbsenceId\": \"<string>\",\n \"calculationType\": \"<string>\",\n \"desc\": \"<string>\",\n \"dtStart\": \"2023-11-07T05:31:56Z\",\n \"dtEnd\": \"2023-11-07T05:31:56Z\",\n \"daysAbsent\": 123,\n \"fullDay\": true,\n \"approvedBy\": \"<string>\",\n \"declinedBy\": \"<string>\",\n \"affectedJobs\": [\n \"<string>\"\n ],\n \"isAssigned\": true,\n \"attachments\": [\n \"<string>\"\n ],\n \"imageIds\": [\n \"<string>\"\n ],\n \"objectManagerIds\": [\n \"<string>\"\n ],\n \"declineComment\": \"<string>\",\n \"sendEmailToCustomer\": true,\n \"affectedObjectIds\": [\n \"<string>\"\n ],\n \"absencePaidTimeArray\": [\n {}\n ],\n \"replacements\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:3000/v2/absences/")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["x-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"_id\": \"<string>\",\n \"number\": 123,\n \"companyId\": \"<string>\",\n \"status\": {\n \"status\": 123,\n \"createdAt\": \"2023-11-07T05:31:56Z\",\n \"createdBy\": \"<string>\",\n \"lastModifiedAt\": \"2023-11-07T05:31:56Z\",\n \"lastModifiedBy\": \"<string>\"\n },\n \"chatId\": \"<string>\",\n \"userId\": \"<string>\",\n \"type\": 123,\n \"payTypeAbsenceId\": \"<string>\",\n \"calculationType\": \"<string>\",\n \"desc\": \"<string>\",\n \"dtStart\": \"2023-11-07T05:31:56Z\",\n \"dtEnd\": \"2023-11-07T05:31:56Z\",\n \"daysAbsent\": 123,\n \"fullDay\": true,\n \"approvedBy\": \"<string>\",\n \"declinedBy\": \"<string>\",\n \"affectedJobs\": [\n \"<string>\"\n ],\n \"isAssigned\": true,\n \"attachments\": [\n \"<string>\"\n ],\n \"imageIds\": [\n \"<string>\"\n ],\n \"objectManagerIds\": [\n \"<string>\"\n ],\n \"declineComment\": \"<string>\",\n \"sendEmailToCustomer\": true,\n \"affectedObjectIds\": [\n \"<string>\"\n ],\n \"absencePaidTimeArray\": [\n {}\n ],\n \"replacements\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_body{
"absenceId": "<string>"
}Create Absence
Create a new absence record for a user. Requires dtStart and dtEnd dates. If no userId is provided, creates absence for the authenticated user.
curl --request POST \
--url http://localhost:3000/v2/absences/ \
--header 'Content-Type: application/json' \
--header 'x-API-Key: <api-key>' \
--data '
{
"_id": "<string>",
"number": 123,
"companyId": "<string>",
"status": {
"status": 123,
"createdAt": "2023-11-07T05:31:56Z",
"createdBy": "<string>",
"lastModifiedAt": "2023-11-07T05:31:56Z",
"lastModifiedBy": "<string>"
},
"chatId": "<string>",
"userId": "<string>",
"type": 123,
"payTypeAbsenceId": "<string>",
"calculationType": "<string>",
"desc": "<string>",
"dtStart": "2023-11-07T05:31:56Z",
"dtEnd": "2023-11-07T05:31:56Z",
"daysAbsent": 123,
"fullDay": true,
"approvedBy": "<string>",
"declinedBy": "<string>",
"affectedJobs": [
"<string>"
],
"isAssigned": true,
"attachments": [
"<string>"
],
"imageIds": [
"<string>"
],
"objectManagerIds": [
"<string>"
],
"declineComment": "<string>",
"sendEmailToCustomer": true,
"affectedObjectIds": [
"<string>"
],
"absencePaidTimeArray": [
{}
],
"replacements": [
{}
]
}
'import requests
url = "http://localhost:3000/v2/absences/"
payload = {
"_id": "<string>",
"number": 123,
"companyId": "<string>",
"status": {
"status": 123,
"createdAt": "2023-11-07T05:31:56Z",
"createdBy": "<string>",
"lastModifiedAt": "2023-11-07T05:31:56Z",
"lastModifiedBy": "<string>"
},
"chatId": "<string>",
"userId": "<string>",
"type": 123,
"payTypeAbsenceId": "<string>",
"calculationType": "<string>",
"desc": "<string>",
"dtStart": "2023-11-07T05:31:56Z",
"dtEnd": "2023-11-07T05:31:56Z",
"daysAbsent": 123,
"fullDay": True,
"approvedBy": "<string>",
"declinedBy": "<string>",
"affectedJobs": ["<string>"],
"isAssigned": True,
"attachments": ["<string>"],
"imageIds": ["<string>"],
"objectManagerIds": ["<string>"],
"declineComment": "<string>",
"sendEmailToCustomer": True,
"affectedObjectIds": ["<string>"],
"absencePaidTimeArray": [{}],
"replacements": [{}]
}
headers = {
"x-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
_id: '<string>',
number: 123,
companyId: '<string>',
status: {
status: 123,
createdAt: '2023-11-07T05:31:56Z',
createdBy: '<string>',
lastModifiedAt: '2023-11-07T05:31:56Z',
lastModifiedBy: '<string>'
},
chatId: '<string>',
userId: '<string>',
type: 123,
payTypeAbsenceId: '<string>',
calculationType: '<string>',
desc: '<string>',
dtStart: '2023-11-07T05:31:56Z',
dtEnd: '2023-11-07T05:31:56Z',
daysAbsent: 123,
fullDay: true,
approvedBy: '<string>',
declinedBy: '<string>',
affectedJobs: ['<string>'],
isAssigned: true,
attachments: ['<string>'],
imageIds: ['<string>'],
objectManagerIds: ['<string>'],
declineComment: '<string>',
sendEmailToCustomer: true,
affectedObjectIds: ['<string>'],
absencePaidTimeArray: [{}],
replacements: [{}]
})
};
fetch('http://localhost:3000/v2/absences/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "3000",
CURLOPT_URL => "http://localhost:3000/v2/absences/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'_id' => '<string>',
'number' => 123,
'companyId' => '<string>',
'status' => [
'status' => 123,
'createdAt' => '2023-11-07T05:31:56Z',
'createdBy' => '<string>',
'lastModifiedAt' => '2023-11-07T05:31:56Z',
'lastModifiedBy' => '<string>'
],
'chatId' => '<string>',
'userId' => '<string>',
'type' => 123,
'payTypeAbsenceId' => '<string>',
'calculationType' => '<string>',
'desc' => '<string>',
'dtStart' => '2023-11-07T05:31:56Z',
'dtEnd' => '2023-11-07T05:31:56Z',
'daysAbsent' => 123,
'fullDay' => true,
'approvedBy' => '<string>',
'declinedBy' => '<string>',
'affectedJobs' => [
'<string>'
],
'isAssigned' => true,
'attachments' => [
'<string>'
],
'imageIds' => [
'<string>'
],
'objectManagerIds' => [
'<string>'
],
'declineComment' => '<string>',
'sendEmailToCustomer' => true,
'affectedObjectIds' => [
'<string>'
],
'absencePaidTimeArray' => [
[
]
],
'replacements' => [
[
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://localhost:3000/v2/absences/"
payload := strings.NewReader("{\n \"_id\": \"<string>\",\n \"number\": 123,\n \"companyId\": \"<string>\",\n \"status\": {\n \"status\": 123,\n \"createdAt\": \"2023-11-07T05:31:56Z\",\n \"createdBy\": \"<string>\",\n \"lastModifiedAt\": \"2023-11-07T05:31:56Z\",\n \"lastModifiedBy\": \"<string>\"\n },\n \"chatId\": \"<string>\",\n \"userId\": \"<string>\",\n \"type\": 123,\n \"payTypeAbsenceId\": \"<string>\",\n \"calculationType\": \"<string>\",\n \"desc\": \"<string>\",\n \"dtStart\": \"2023-11-07T05:31:56Z\",\n \"dtEnd\": \"2023-11-07T05:31:56Z\",\n \"daysAbsent\": 123,\n \"fullDay\": true,\n \"approvedBy\": \"<string>\",\n \"declinedBy\": \"<string>\",\n \"affectedJobs\": [\n \"<string>\"\n ],\n \"isAssigned\": true,\n \"attachments\": [\n \"<string>\"\n ],\n \"imageIds\": [\n \"<string>\"\n ],\n \"objectManagerIds\": [\n \"<string>\"\n ],\n \"declineComment\": \"<string>\",\n \"sendEmailToCustomer\": true,\n \"affectedObjectIds\": [\n \"<string>\"\n ],\n \"absencePaidTimeArray\": [\n {}\n ],\n \"replacements\": [\n {}\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://localhost:3000/v2/absences/")
.header("x-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"_id\": \"<string>\",\n \"number\": 123,\n \"companyId\": \"<string>\",\n \"status\": {\n \"status\": 123,\n \"createdAt\": \"2023-11-07T05:31:56Z\",\n \"createdBy\": \"<string>\",\n \"lastModifiedAt\": \"2023-11-07T05:31:56Z\",\n \"lastModifiedBy\": \"<string>\"\n },\n \"chatId\": \"<string>\",\n \"userId\": \"<string>\",\n \"type\": 123,\n \"payTypeAbsenceId\": \"<string>\",\n \"calculationType\": \"<string>\",\n \"desc\": \"<string>\",\n \"dtStart\": \"2023-11-07T05:31:56Z\",\n \"dtEnd\": \"2023-11-07T05:31:56Z\",\n \"daysAbsent\": 123,\n \"fullDay\": true,\n \"approvedBy\": \"<string>\",\n \"declinedBy\": \"<string>\",\n \"affectedJobs\": [\n \"<string>\"\n ],\n \"isAssigned\": true,\n \"attachments\": [\n \"<string>\"\n ],\n \"imageIds\": [\n \"<string>\"\n ],\n \"objectManagerIds\": [\n \"<string>\"\n ],\n \"declineComment\": \"<string>\",\n \"sendEmailToCustomer\": true,\n \"affectedObjectIds\": [\n \"<string>\"\n ],\n \"absencePaidTimeArray\": [\n {}\n ],\n \"replacements\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:3000/v2/absences/")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["x-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"_id\": \"<string>\",\n \"number\": 123,\n \"companyId\": \"<string>\",\n \"status\": {\n \"status\": 123,\n \"createdAt\": \"2023-11-07T05:31:56Z\",\n \"createdBy\": \"<string>\",\n \"lastModifiedAt\": \"2023-11-07T05:31:56Z\",\n \"lastModifiedBy\": \"<string>\"\n },\n \"chatId\": \"<string>\",\n \"userId\": \"<string>\",\n \"type\": 123,\n \"payTypeAbsenceId\": \"<string>\",\n \"calculationType\": \"<string>\",\n \"desc\": \"<string>\",\n \"dtStart\": \"2023-11-07T05:31:56Z\",\n \"dtEnd\": \"2023-11-07T05:31:56Z\",\n \"daysAbsent\": 123,\n \"fullDay\": true,\n \"approvedBy\": \"<string>\",\n \"declinedBy\": \"<string>\",\n \"affectedJobs\": [\n \"<string>\"\n ],\n \"isAssigned\": true,\n \"attachments\": [\n \"<string>\"\n ],\n \"imageIds\": [\n \"<string>\"\n ],\n \"objectManagerIds\": [\n \"<string>\"\n ],\n \"declineComment\": \"<string>\",\n \"sendEmailToCustomer\": true,\n \"affectedObjectIds\": [\n \"<string>\"\n ],\n \"absencePaidTimeArray\": [\n {}\n ],\n \"replacements\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_body{
"absenceId": "<string>"
}Authorizations
Body
Absence data
Absence record for a user, including type, dates, and affected jobs.
Unique identifier for the absence
Unique number of the entity, used for identification
The ID of the company this entity belongs to
Status struct for the absence
Show child attributes
Show child attributes
ID of the chat associated with this entity
User ID for whom the absence is recorded
Absence type (e.g., illness, vacation, unpaid leave)
Pay type absence ID
Calculation type for the absence
Description or comment for the absence
Start date/time of the absence
End date/time of the absence
Number of days absent
Whether the absence is for a full day
User ID who approved the absence
User ID who declined the absence
List of job IDs affected by this absence
Whether all replacement jobs are assigned
Attachment IDs or file references
Image IDs associated with the absence
IDs of object managers
Comment for declined absence
Whether to send an email to the customer
IDs of affected objects
Paid time for each day of the absence
Replacement assignments for the absence
Response
Absence created successfully
ID of the created absence
Was this page helpful?

