curl --request POST \
--url https://api.absentify.com/api/v1/allowance-types/{allowance_type_id}/rules \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"name": "<string>",
"accrual_month": 5,
"rule_amount": 123,
"accrual_anchor_date": "<string>",
"cycle_on_employment_start": false,
"rule_duration": 600,
"upfront_allocation": true,
"proration_basis": "month",
"max_carry_forward": 50000,
"carry_forward_expiry_months": 600,
"carry_forward_kept_after_expiry": 50000,
"part_time_basis": "none",
"part_time_reference": 84,
"part_time_from": "<string>"
}
'import requests
url = "https://api.absentify.com/api/v1/allowance-types/{allowance_type_id}/rules"
payload = {
"name": "<string>",
"accrual_month": 5,
"rule_amount": 123,
"accrual_anchor_date": "<string>",
"cycle_on_employment_start": False,
"rule_duration": 600,
"upfront_allocation": True,
"proration_basis": "month",
"max_carry_forward": 50000,
"carry_forward_expiry_months": 600,
"carry_forward_kept_after_expiry": 50000,
"part_time_basis": "none",
"part_time_reference": 84,
"part_time_from": "<string>"
}
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({
name: '<string>',
accrual_month: 5,
rule_amount: 123,
accrual_anchor_date: '<string>',
cycle_on_employment_start: false,
rule_duration: 600,
upfront_allocation: true,
proration_basis: 'month',
max_carry_forward: 50000,
carry_forward_expiry_months: 600,
carry_forward_kept_after_expiry: 50000,
part_time_basis: 'none',
part_time_reference: 84,
part_time_from: '<string>'
})
};
fetch('https://api.absentify.com/api/v1/allowance-types/{allowance_type_id}/rules', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.absentify.com/api/v1/allowance-types/{allowance_type_id}/rules",
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([
'name' => '<string>',
'accrual_month' => 5,
'rule_amount' => 123,
'accrual_anchor_date' => '<string>',
'cycle_on_employment_start' => false,
'rule_duration' => 600,
'upfront_allocation' => true,
'proration_basis' => 'month',
'max_carry_forward' => 50000,
'carry_forward_expiry_months' => 600,
'carry_forward_kept_after_expiry' => 50000,
'part_time_basis' => 'none',
'part_time_reference' => 84,
'part_time_from' => '<string>'
]),
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 := "https://api.absentify.com/api/v1/allowance-types/{allowance_type_id}/rules"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"accrual_month\": 5,\n \"rule_amount\": 123,\n \"accrual_anchor_date\": \"<string>\",\n \"cycle_on_employment_start\": false,\n \"rule_duration\": 600,\n \"upfront_allocation\": true,\n \"proration_basis\": \"month\",\n \"max_carry_forward\": 50000,\n \"carry_forward_expiry_months\": 600,\n \"carry_forward_kept_after_expiry\": 50000,\n \"part_time_basis\": \"none\",\n \"part_time_reference\": 84,\n \"part_time_from\": \"<string>\"\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("https://api.absentify.com/api/v1/allowance-types/{allowance_type_id}/rules")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"accrual_month\": 5,\n \"rule_amount\": 123,\n \"accrual_anchor_date\": \"<string>\",\n \"cycle_on_employment_start\": false,\n \"rule_duration\": 600,\n \"upfront_allocation\": true,\n \"proration_basis\": \"month\",\n \"max_carry_forward\": 50000,\n \"carry_forward_expiry_months\": 600,\n \"carry_forward_kept_after_expiry\": 50000,\n \"part_time_basis\": \"none\",\n \"part_time_reference\": 84,\n \"part_time_from\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.absentify.com/api/v1/allowance-types/{allowance_type_id}/rules")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"accrual_month\": 5,\n \"rule_amount\": 123,\n \"accrual_anchor_date\": \"<string>\",\n \"cycle_on_employment_start\": false,\n \"rule_duration\": 600,\n \"upfront_allocation\": true,\n \"proration_basis\": \"month\",\n \"max_carry_forward\": 50000,\n \"carry_forward_expiry_months\": 600,\n \"carry_forward_kept_after_expiry\": 50000,\n \"part_time_basis\": \"none\",\n \"part_time_reference\": 84,\n \"part_time_from\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>"
}{
"code": "BAD_REQUEST",
"message": "Invalid input data",
"issues": []
}{
"code": "UNAUTHORIZED",
"message": "Authorization not provided",
"issues": []
}{
"code": "FORBIDDEN",
"message": "Insufficient access",
"issues": []
}{
"code": "INTERNAL_SERVER_ERROR",
"message": "Internal server error",
"issues": []
}Create a new allowance rule
Creates a new allowance rule for the given allowance type. Rules define how much allowance members receive and how it accrues (monthly or yearly).
curl --request POST \
--url https://api.absentify.com/api/v1/allowance-types/{allowance_type_id}/rules \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"name": "<string>",
"accrual_month": 5,
"rule_amount": 123,
"accrual_anchor_date": "<string>",
"cycle_on_employment_start": false,
"rule_duration": 600,
"upfront_allocation": true,
"proration_basis": "month",
"max_carry_forward": 50000,
"carry_forward_expiry_months": 600,
"carry_forward_kept_after_expiry": 50000,
"part_time_basis": "none",
"part_time_reference": 84,
"part_time_from": "<string>"
}
'import requests
url = "https://api.absentify.com/api/v1/allowance-types/{allowance_type_id}/rules"
payload = {
"name": "<string>",
"accrual_month": 5,
"rule_amount": 123,
"accrual_anchor_date": "<string>",
"cycle_on_employment_start": False,
"rule_duration": 600,
"upfront_allocation": True,
"proration_basis": "month",
"max_carry_forward": 50000,
"carry_forward_expiry_months": 600,
"carry_forward_kept_after_expiry": 50000,
"part_time_basis": "none",
"part_time_reference": 84,
"part_time_from": "<string>"
}
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({
name: '<string>',
accrual_month: 5,
rule_amount: 123,
accrual_anchor_date: '<string>',
cycle_on_employment_start: false,
rule_duration: 600,
upfront_allocation: true,
proration_basis: 'month',
max_carry_forward: 50000,
carry_forward_expiry_months: 600,
carry_forward_kept_after_expiry: 50000,
part_time_basis: 'none',
part_time_reference: 84,
part_time_from: '<string>'
})
};
fetch('https://api.absentify.com/api/v1/allowance-types/{allowance_type_id}/rules', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.absentify.com/api/v1/allowance-types/{allowance_type_id}/rules",
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([
'name' => '<string>',
'accrual_month' => 5,
'rule_amount' => 123,
'accrual_anchor_date' => '<string>',
'cycle_on_employment_start' => false,
'rule_duration' => 600,
'upfront_allocation' => true,
'proration_basis' => 'month',
'max_carry_forward' => 50000,
'carry_forward_expiry_months' => 600,
'carry_forward_kept_after_expiry' => 50000,
'part_time_basis' => 'none',
'part_time_reference' => 84,
'part_time_from' => '<string>'
]),
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 := "https://api.absentify.com/api/v1/allowance-types/{allowance_type_id}/rules"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"accrual_month\": 5,\n \"rule_amount\": 123,\n \"accrual_anchor_date\": \"<string>\",\n \"cycle_on_employment_start\": false,\n \"rule_duration\": 600,\n \"upfront_allocation\": true,\n \"proration_basis\": \"month\",\n \"max_carry_forward\": 50000,\n \"carry_forward_expiry_months\": 600,\n \"carry_forward_kept_after_expiry\": 50000,\n \"part_time_basis\": \"none\",\n \"part_time_reference\": 84,\n \"part_time_from\": \"<string>\"\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("https://api.absentify.com/api/v1/allowance-types/{allowance_type_id}/rules")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"accrual_month\": 5,\n \"rule_amount\": 123,\n \"accrual_anchor_date\": \"<string>\",\n \"cycle_on_employment_start\": false,\n \"rule_duration\": 600,\n \"upfront_allocation\": true,\n \"proration_basis\": \"month\",\n \"max_carry_forward\": 50000,\n \"carry_forward_expiry_months\": 600,\n \"carry_forward_kept_after_expiry\": 50000,\n \"part_time_basis\": \"none\",\n \"part_time_reference\": 84,\n \"part_time_from\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.absentify.com/api/v1/allowance-types/{allowance_type_id}/rules")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"accrual_month\": 5,\n \"rule_amount\": 123,\n \"accrual_anchor_date\": \"<string>\",\n \"cycle_on_employment_start\": false,\n \"rule_duration\": 600,\n \"upfront_allocation\": true,\n \"proration_basis\": \"month\",\n \"max_carry_forward\": 50000,\n \"carry_forward_expiry_months\": 600,\n \"carry_forward_kept_after_expiry\": 50000,\n \"part_time_basis\": \"none\",\n \"part_time_reference\": 84,\n \"part_time_from\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>"
}{
"code": "BAD_REQUEST",
"message": "Invalid input data",
"issues": []
}{
"code": "UNAUTHORIZED",
"message": "Authorization not provided",
"issues": []
}{
"code": "FORBIDDEN",
"message": "Insufficient access",
"issues": []
}{
"code": "INTERNAL_SERVER_ERROR",
"message": "Internal server error",
"issues": []
}Autorisierungen
Pfadparameter
^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$Body
10 = January, 11 = December
0 <= x <= 11Allowance amount per accrual cycle, must be greater than 0. For day-based allowance types the value is in days; for hour-based allowance types the value is in MINUTES (e.g. 480 = 8 hours). A 0-amount (manual) rule is created by assigning a member to manage manually, not through this endpoint.
x <= 100000month, year, biweek Bi-weekly cycle anchor (YYYY-MM-DD); null = count from each member's start date
^\d{4}-\d{2}-\d{2}$Starts each allowance year on the member's employment start date instead of accrual_month. Yearly rules only: a monthly or bi-weekly rule with true is rejected, so a PATCH that moves a rule with true away from accrual_cycle year must also send false.
Per-accrual rolling expiry: each accrual is valid for this many months from its accrual date, then expires automatically (like time off in lieu). Min 1; null = off. Cannot be combined with any carry-forward setting, and is not allowed on a 0-amount (manual) rule.
1 <= x <= 1200If true, full allowance is granted at start of cycle
How partial yearly rules are prorated. month = whole months count fully, the partial start or end month is prorated by day; day = calendar-day exact; full_month = only whole months count 1/12 each, a started month counts nothing; none = a rule year in which employment starts or ends grants the full yearly amount; every other partial year, such as a switch to another rule or an assignment that starts or ends during the year while employed, counts its months. Ignored for monthly and biweekly cycles. Defaults to month.
month, day, full_month, none Hard cap on the amount carried into the next fiscal year, applied at the year boundary. null = unlimited (everything carries), 0 = nothing carries. For hour-based allowance types the value is in MINUTES.
0 <= x <= 100000How long carried-forward allowance stays usable in the new fiscal year. null = it never expires; N (>= 1) = usable until the last day of the Nth month after the fiscal year end, then forfeited (except carry_forward_kept_after_expiry).
1 <= x <= 1200Amount of the carried-forward allowance that survives permanently after the expiry deadline. Only allowed when carry_forward_expiry_months is set; must be lower than max_carry_forward when both are set. null/0 = nothing survives. For hour-based allowance types the value is in MINUTES.
0 <= x <= 100000Scales every grant of this rule to the member's own working week. none = off; workdays = by the days worked per week; hours = by the hours worked per week. A member with no schedule of their own counts as full time.
none, workdays, hours Days (workdays) or hours (hours) per week that count as full time. Required and greater than 0 when part_time_basis is not none; stored as null when it is none.
0 < x <= 168First day (inclusive, YYYY-MM-DD) the scaling applies to. A grant for a year, month or two weeks that started earlier is not scaled. A new date must not be before the first day of the current fiscal year. Without a date (null included), a new or newly scaling rule starts on that day and a rule that already scales keeps its stored date. Stored as null when part_time_basis is none.
^\d{4}-\d{2}-\d{2}$Antwort
Successful response
War diese Seite hilfreich?