Absences
The API- functions for Absences in Papershift
Create a new Absence
Creates a new Absence in your Papershift Account
URL
https://app.papershift.com/public_api/v1/absences
Method
POST
Parameters
Parameters | 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 |
Information
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.
Example
{
"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
URL
https://app.papershift.com/public_api/v1/absences
Method
PUT
Parameters
Parameters | 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 |
Information
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.
Example
{
"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 unique ID or external ID
URL
https://app.papershift.com/public_api/v1/absences
Method
GET
Parameters
Parameters | Type | Required |
---|---|---|
api_token | string | required |
id | integer | required (if external_id not set) |
external_id | string | required (if id not set) |
Example
{
"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
URL
https://app.papershift.com/public_api/v1/absences
Method
GET
Parameters
Parameters | 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 |
page | Integer | optional |
Information
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.
Example
{
"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.
URL
https://app.papershift.com/public_api/v1/absences/confirm
Method
PUT
Parameters
Parameters | Type | Required |
---|---|---|
api_token | String | required |
id | Integer | required |
external_id | String | required if id not set |
Information
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".
Example
{
"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.
URL
https://app.papershift.com/public_api/v1/absences
Method
DELETE
Parameters
Parameters | Type | Required |
---|---|---|
api_token | String | required |
id | Integer | required |
external_id | String | required if id not set |
Information
To delete an existing Absence requires finding the specific record
in the Database. This can be achieved via the Absence’s External-ID
or Record-ID.
Example
{
"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 10 months ago