Create User Leave
curl --request POST \
--url https://api.projectcor.com/v1/user/leaves \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"userId": 8555,
"leaveTypeId": 11,
"start": "2024-11-18T03:00:00Z",
"end": "2024-11-19T02:59:00Z",
"allDay": true
}
'import requests
url = "https://api.projectcor.com/v1/user/leaves"
payload = {
"userId": 8555,
"leaveTypeId": 11,
"start": "2024-11-18T03:00:00Z",
"end": "2024-11-19T02:59:00Z",
"allDay": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
userId: 8555,
leaveTypeId: 11,
start: '2024-11-18T03:00:00Z',
end: '2024-11-19T02:59:00Z',
allDay: true
})
};
fetch('https://api.projectcor.com/v1/user/leaves', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const url = 'https://api.projectcor.com/v1/user/leaves';
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
userId: 8555,
leaveTypeId: 11,
start: '2024-11-18T03:00:00Z',
end: '2024-11-19T02:59:00Z',
allDay: true
})
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.projectcor.com/v1/user/leaves",
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([
'userId' => 8555,
'leaveTypeId' => 11,
'start' => '2024-11-18T03:00:00Z',
'end' => '2024-11-19T02:59:00Z',
'allDay' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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 := "https://api.projectcor.com/v1/user/leaves"
payload := strings.NewReader("{\n \"userId\": 8555,\n \"leaveTypeId\": 11,\n \"start\": \"2024-11-18T03:00:00Z\",\n \"end\": \"2024-11-19T02:59:00Z\",\n \"allDay\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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))
}{
"user_id": 8555,
"company_id": 2336,
"leave_type_id": 11,
"start": "2024-11-18T03:00:00Z",
"end": "2024-11-19T02:59:00Z",
"created_at": "2024-11-07 22:11:30",
"updated_at": "2024-11-07 22:11:30",
"all_day": false,
"id": 16332
}User Leaves
Create User Leave
Creates a new user leave.
⚠️ Important:
- Dates must be sent in UTC format (e.g.,
2024-11-18T03:00:00Z) - Dates cannot overlap with existing leaves for the same user
- If there is an existing date between the submitted dates, the request will not be saved
POST
/
user
/
leaves
Create User Leave
curl --request POST \
--url https://api.projectcor.com/v1/user/leaves \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"userId": 8555,
"leaveTypeId": 11,
"start": "2024-11-18T03:00:00Z",
"end": "2024-11-19T02:59:00Z",
"allDay": true
}
'import requests
url = "https://api.projectcor.com/v1/user/leaves"
payload = {
"userId": 8555,
"leaveTypeId": 11,
"start": "2024-11-18T03:00:00Z",
"end": "2024-11-19T02:59:00Z",
"allDay": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
userId: 8555,
leaveTypeId: 11,
start: '2024-11-18T03:00:00Z',
end: '2024-11-19T02:59:00Z',
allDay: true
})
};
fetch('https://api.projectcor.com/v1/user/leaves', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const url = 'https://api.projectcor.com/v1/user/leaves';
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
userId: 8555,
leaveTypeId: 11,
start: '2024-11-18T03:00:00Z',
end: '2024-11-19T02:59:00Z',
allDay: true
})
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.projectcor.com/v1/user/leaves",
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([
'userId' => 8555,
'leaveTypeId' => 11,
'start' => '2024-11-18T03:00:00Z',
'end' => '2024-11-19T02:59:00Z',
'allDay' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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 := "https://api.projectcor.com/v1/user/leaves"
payload := strings.NewReader("{\n \"userId\": 8555,\n \"leaveTypeId\": 11,\n \"start\": \"2024-11-18T03:00:00Z\",\n \"end\": \"2024-11-19T02:59:00Z\",\n \"allDay\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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))
}{
"user_id": 8555,
"company_id": 2336,
"leave_type_id": 11,
"start": "2024-11-18T03:00:00Z",
"end": "2024-11-19T02:59:00Z",
"created_at": "2024-11-07 22:11:30",
"updated_at": "2024-11-07 22:11:30",
"all_day": false,
"id": 16332
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Response
200 - application/json
Leave created successfully
Was this page helpful?
⌘I

