Absences
The API functions for Absences in Papershift
Create a new Absence
Creates a new absence in your Papershift account
URLhttps://app.papershift.com/public_api/v1/absences
MethodPOST
ParametersParameters | Type | Required |
---|---|---|
api_token | String | required |
absence_type_id | Integer | required |
absence_type_external_id | String | required if absence_type_id is not set |
user_id | Integer | required |
user_external_id | String | required if user_id is not set |
starts_at | String (use ISO) | required |
ends_at | String (use ISO) | required |
time_zone | String | optional (but recommended) |
full_day | Boolean | optional |
external_id | String | optional |
force_calc_custom_hours | Boolean | optional |
paid_hours | Float | required if force_calc_custom_hours is true |
vacation_days | Float | required if force_calc_custom_hours is true |
Creating absences requires a valid absence type and user within the
authorized Enterprise. You either get these through the external ID
you simply set by yourself or the record’s ID from the database.
{
"api_token":"U6H2QWD6UWsI8sgs6TyvoK1E6HdliuTL2LgniO18",
"absence":{
"absence_type_external_id":"Urlaub-001",
"absence_type_id":2,
"user_external_id":"User-001",
"user_id":1,
"starts_at":"2022-10-31T08:30:00+01:00",
"ends_at":"2022-10-31T17:30:00+01:00",
"time_zone":"Europe/Berlin",
"full_day":false,
"external_id":"Absence-001"
}
}
function createAbsence() {
var params = {
"api_token": "rJkAk7Bzm5uDipfJY9aZtWhHxfsz06oO5ggJyvI7",
"absence": {
"absence_type_external_id": "Urlaub-001",
"user_external_id": "User-001",
"starts_at": "2022-10-31T08:30:00+01:00",
"ends_at": "2022-10-31T17:30:00+01:00",
"time_zone": "Europe/Berlin",
"full_day": false,
"external_id": "Absence-001"
}
};
$.ajax({
url: "https://app.papershift.com/public_api/v1/absences",
type: 'POST',
dataType: 'json',
data: JSON.stringify(params),
complete: function (data) {
console.log(data.responseText);
}
});
}
{
"absence_type_id":16114,
"confirm":null,
"confirmed_at":null,
"confirmed_by":null,
"created_at":"2022-10-21T12:07:34Z",
"created_by":null,
"ends_at":"2022-10-31T17:30:00Z",
"external_id":"Absence-001",
"force_calc_custom_hours":false,
"full_day":false,
"id":29971,
"note":null,
"paid_hours":0,
"starts_at":"2022-10-31T08:30:00Z",
"time_zone":"Europe/Berlin",
"title":"Urlaub",
"updated_at":"2022-10-21T12:07:34Z",
"user_id":1,
"vacation_days":0
}
Update an existing Absence
Update an absence in your Papershift account
URLhttps://app.papershift.com/public_api/v1/absences
MethodPUT
ParametersParameters | Type | Required |
---|---|---|
api_token | String | required |
id | Integer | required |
external_id | String | required if id is not set |
starts_at | String (use ISO) | required |
ends_at | String (use ISO) | required |
time_zone | String | optional (but recommended) |
full_day | Boolean | optional |
force_calc_custom_hours | Boolean | optional |
paid_hours | Float | required if force_calc_custom_hours is true |
vacation_days | Float | required if force_calc_custom_hours is true |
Updating an existing absence requires finding the specific record
in the database. This can be achieved via the absence’s external ID
or record ID.
{
"api_token":"U6H2QWD6UWsI8sgs6TyvoK1E6HdliuTL2LgniO18",
"absence":{
"external_id":"Absence-001",
"id":29971,
"starts_at":"2022-10-31T08:15:00+01:00",
"ends_at":"2022-10-31T17:45:00+01:00",
"time_zone":"Europe/Berlin",
"full_day":false
}
}
function updateAbsence() {
var params = {
"api_token": "rJkAk7Bzm5uDipfJY9aZtWhHxfsz06oO5ggJyvI7",
"absence": {
"external_id": "Absence-001",
"id": 29971,
"starts_at": "2022-10-31T08:15:00+01:00",
"ends_at": "2022-10-31T17:45:00+01:00",
"time_zone": "Europe/Berlin",
"full_day": false
}
};
$.ajax({
url: "https://app.papershift.com/public_api/v1/absences",
type: 'PUT',
dataType: 'json',
data: JSON.stringify(params),
complete: function (data) {
console.log(data.responseText);
}
});
}
{
"absence_type_id":16114,
"confirm":null,
"confirmed_at":null,
"confirmed_by":null,
"created_at":"2022-10-21T12:07:34Z",
"created_by":null,
"ends_at":"2022-10-31T17:45:00Z",
"external_id":"Absence-001",
"force_calc_custom_hours":false,
"full_day":false,
"id":29971,
"note":null,
"paid_hours":0,
"starts_at":"2022-10-31T08:15:00Z",
"time_zone":"Europe/Berlin",
"title":"Urlaub",
"updated_at":"2022-10-21T15:36:34Z",
"user_id":1,
"vacation_days":0
}
Get Absence by ID
Get absence by its ID or external ID
URLhttps://app.papershift.com/public_api/v1/absences
MethodGET
ParametersParameters | Type | Required |
---|---|---|
api_token | string | required |
id | integer | required |
external_id | string | required if id not set |
{
"api_token":"XXXX",
"id":873225
}
{
"absence_type_id":186571,
"charge_days_job_status":"success",
"confirm_message":null,
"confirmed":true,
"confirmed_at":"2022-03-27T10:44:31+01:00",
"confirmed_by":141216,
"created_at":"2022-03-27T10:44:31+01:00",
"created_by":141216,
"ends_at":"2022-03-13T23:59:59+01:00",
"external_id":null,
"force_calc_custom_hours":false,
"full_day":true,
"id":873225,
"import_id":null,
"outlook_id":null,
"paid_hours":8,
"secure_id":"934443d654c45167e71fbe6dbac2ddff",
"starts_at":"2022-03-13T00:00:00+01:00",
"status":"active",
"time_zone":"Europe/Berlin",
"title":"Weiterbildung Firma",
"updated_at":"2022-03-27T10:44:31+01:00",
"user_id":271693,
"uuid":"b0547997-3090-4014-a84b-fc59313790f9",
"vacation_days":0,
"absence_type_external_id":""
}
Get Absence in Range
Response absence(s) between two dates
URLhttps://app.papershift.com/public_api/v1/absences
MethodGET
ParametersParameters | Type | Required |
---|---|---|
api_token | String | required |
range_start | String (use ISO) | required |
range_end | String (use ISO) | required |
user_id | Integer | optional |
user_external_id | String | optional |
location_id | Integer | optional |
location_external_id | String | optional |
page | Integer | optional |
A successful request returns an array of the n-th 25 absences depending
on the page param. You can also pass a user’s external- or record ID
to only query for absences of this specific user. Additionally, optional parameters
such as location_id or location_external_id allow you to retrieve absences
for a specific location.
{
"api_token":"U6H2QWD6UWsI8sgs6TyvoK1E6HdliuTL2LgniO18",
"range_start":"2022-10-01",
"range_end":"2022-10-31",
"user_external_id":"User-001",
"user_id":5,
"page":1
}
function getAbsences() {
var api_token = "rJkAk7Bzm5uDipfJY9aZtWhHxfsz06oO5ggJyvI7";
var range_start = "2022-10-01";
var range_end = "2022-10-31";
$.ajax({
url: "https://app.papershift.com/public_api/v1/absences?api_token=" + api_token + "&range_start=" + range_start + "&range_end=" + range_end,
type: 'GET',
dataType: 'json',
complete: function (data) {
console.log(data.responseText);
}
});
}
{
"absences":[
{
"absence_type_id":16114,
"confirm":null,
"confirmed_at":null,
"confirmed_by":null,
"created_at":"2022-10-21T12:07:34Z",
"created_by":null,
"ends_at":"2022-10-31T17:45:00Z",
"external_id":"Absence-001",
"force_calc_custom_hours":false,
"full_day":false,
"id":29971,
"note":null,
"paid_hours":0,
"starts_at":"2022-10-31T08:15:00Z",
"time_zone":"Europe/Berlin",
"title":"Urlaub",
"updated_at":"2022-10-21T15:36:34Z",
"user_id":1,
"vacation_days":0
}
],
"page_number":1,
"total_pages":1,
"next_page":null
}
Confirm/reset/reject an existing Absence
Confirm an existing absence in your Papershift account.
URLhttps://app.papershift.com/public_api/v1/absences/confirm
MethodPUT
ParametersParameters | Type | Required |
---|---|---|
api_token | String | required |
id | Integer | required |
external_id | String | required if id not set |
To confirm an existing absence, it requires finding the specific record
in the database. This can be achieved via the absence’s external ID
or record ID. To reset or reject an absence, just replace "confirm" in the
URL with the necessary action "reset" or "reject".
{
"api_token": "U6H2QWD6UWsI8sgs6TyvoK1E6HdliuTL2LgniO18",
"absence": {
"external_id": "Absence-001"
}
}
function confirmAbsence() {
var params = {
"api_token": "rJkAk7Bzm5uDipfJY9aZtWhHxfsz06oO5ggJyvI7",
"absence": {
"external_id": "Absence-001"
}
};
$.ajax({
url: "https://app.papershift.com/public_api/v1/absences/confirm",
type: 'PUT',
dataType: 'json',
data: JSON.stringify(params),
complete: function (data) {
console.log(data.responseText);
}
});
}
{
"absence_type_id":1,
"charge_days_job_status":"success",
"confirm_message":null,
"confirmed":null,
"confirmed_at":"2022-11-14T10:21:43+02:00",
"confirmed_by":1,
"created_at":"2022-09-25T10:21:43+02:00",
"created_by":1,
"ends_at":"2022-09-15T23:59:59+01:00",
"external_id":null,
"force_calc_custom_hours":false,
"full_day":true,
"id":319980,
"outlook_id":null,
"paid_hours":40,
"secure_id":"a2d71d879ac29213444b9cfb6e54abd5",
"starts_at":"2022-09-11T00:00:00+01:00",
"time_zone":"Europe/Berlin",
"title":"Urlaub",
"updated_at":"2022-11-14T13:25:12+01:00",
"user_id":1,
"vacation_days":5,
"absence_type_external_id":"Absence-001"
}
Delete an existing Absence
Delete an existing absence in your Papershift account.
URLhttps://app.papershift.com/public_api/v1/absences
MethodDELETE
ParametersParameters | Type | Required |
---|---|---|
api_token | String | required |
id | Integer | required |
external_id | String | required if id not set |
Deleting an existing absence requires finding the specific record in the database.
This can be achieved via the absence’s external ID or record ID.
{
"api_token":"U6H2QWD6UWsI8sgs6TyvoK1E6HdliuTL2LgniO18",
"absence":{
"external_id":"Absence-001",
"id":29971
}
}
function updateAbsence() {
var params = {
"api_token": "rJkAk7Bzm5uDipfJY9aZtWhHxfsz06oO5ggJyvI7",
"absence": {
"external_id": "Absence-001",
"id": 29971
}
};
$.ajax({
url: "https://app.papershift.com/public_api/v1/absences",
type: 'DELETE',
dataType: 'json',
data: JSON.stringify(params),
complete: function (data) {
console.log(data.responseText);
}
});
}
Response 200 (application/json)
Updated 24 days ago