Time Tracking
The API functions for Time Tracking in Papershift
Create a new Time Tracking
Creates a new time tracking entry in your Papershift account
URLhttps://app.papershift.com/public_api/v1/working_sessions
MethodPOST
ParametersParameters | Type | Required |
---|---|---|
api_token | String | required |
location_id | Integer | required |
location_external_id | String | required if location_id is not set |
working_area_id | Integer | required |
working_area_external_id | String | required if working_area_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 |
manual_pause | Integer (in minutes) | optional |
external_id | String | optional |
Creating a time tracking entry requires a valid location, working area 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": "XXXX",
"working_session": {
"location_external_id": "Company-A",
"working_area_external_id": "Area-Alpha",
"user_external_id": "User-001",
"starts_at": "2015-10-31T08:30:00+00:00",
"ends_at": "2015-10-31T17:30:00+00:00",
"manual_pause": 60,
"external_id": "WorkingSession-001"
}
}
function createWorkingSession() {
var params = {
"api_token": "XXXX",
"working_session": {
"location_external_id": "Company-A",
"working_area_external_id": "Area-Alpha",
"user_external_id": "User-001",
"starts_at": "2015-10-31T08:30:00+00:00",
"ends_at": "2015-10-31T17:30:00+00:00",
"manual_pause": 60,
"external_id": "WorkingSession-001"
}
};
$.ajax({
url: "https://app.papershift.com/public_api/v1/working_sessions",
type: 'POST',
dataType: 'json',
data: JSON.stringify(params),
complete: function (data) {
console.log(data.responseText);
}
});
}
{
"id": 1491029,
"starts_at": "2015-10-31T09:30:00+01:00",
"ends_at": "2015-10-31T18:30:00+01:00",
"updated_at": "2015-11-19T19:14:27+00:00",
"location_id": 8006,
"employee_id": 1,
"break_time": 3600
}
Update an existing Time Tracking
Update an existing time tracking entry in your Papershift account
URLhttps://app.papershift.com/public_api/v1/working_sessions
MethodPUT
ParametersParameters | Type | Required |
---|---|---|
api_token | String | required |
id | Integer | required |
external_id | String | required if id not set |
starts_at | String (use ISO) | required |
ends_at | String (use ISO) | required |
manual_pause | Integer (in minutes) | optional |
working_area_id | Integer | optional |
working_area_external_id | String | optional |
tags | comma separated list of ids | optional |
Updating an existing time tracking entry requires finding the specific record in the database. This can be achieved via the time tracking entry’s external ID or record ID.
Example{
"api_token": "XXXX",
"working_session": {
"external_id": "WorkingSession-001",
"starts_at": "2015-10-31T08:15:00+00:00",
"ends_at": "2015-10-31T17:45:00+00:00",
"manual_pause": 50,
"working_area_external_id": "Area-Alpha",
"tags": "1, 28"
}
}
function updateWorkingSession() {
var params = {
"api_token": "XXXX",
"working_session": {
"external_id": "WorkingSession-001",
"starts_at": "2015-10-31T08:15:00+00:00",
"ends_at": "2015-10-31T17:45:00+00:00",
"manual_pause": 50,
"working_area_external_id": "Area-Alpha"
}
};
$.ajax({
url: "https://app.papershift.com/public_api/v1/working_sessions",
type: 'PUT',
dataType: 'json',
data: JSON.stringify(params),
complete: function (data) {
console.log(data.responseText);
}
});
}
{
"id": 1491029,
"starts_at": "2015-10-31T09:15:00+01:00",
"ends_at": "2015-10-31T18:45:00+01:00",
"updated_at": "2015-11-19T19:23:27+00:00",
"location_id": 8006,
"employee_id": 1,
"break_time": 3000,
"working_area_id": 12,
"filters": [
{
"id": 1,
"title": "first_tag",
"active": true,
"external_id": null,
"color": null
},
{
"id": 28,
"title": "second_tag",
"active": true,
"external_id": null,
"color": null
}
]
}
Get Time Tracking by ID
Get a time tracking entry by its unique ID or external ID
URLhttps://app.papershift.com/public_api/v1/working_sessions
MethodGET
ParametersParameters | Type | Required |
---|---|---|
api_token | string | required |
id | integer | required |
external_id | string | required if id is not set |
{
"api_token": "XXXX",
"id": 17325954
}
{
"ends_at": "2019-06-10T18:00:00+02:00",
"id": 17325954,
"starts_at": "2019-06-10T08:00:00+02:00",
"updated_at": "2018-09-18T10:46:10+02:00",
"location_id": 60414,
"employee_id": 245602,
"breaks": [
{
"ends_at": "2019-06-10T15:54:00+02:00",
"id": 9420514,
"starts_at": "2019-06-10T14:54:00+02:00",
"updated_at": "2018-09-26T17:22:02+02:00",
"start_signature_id": null,
"end_signature_id": null,
"secure_id": "379bf999ea58561cae61f0d120519c27"
}
],
"break_time": 3600,
"start_signature_id": null,
"end_signature_id": null,
"secure_id": "6312e2c07cc670c79d5567e8c40b6fdb",
"filters": [
{
"id": 67087,
"title": "Berater",
"active": true,
"external_id": null,
"color": "#6C7A89"
}
]
}
Get Time Tracking in Range
Get existing time tracking entries from your Papershift account
URLhttps://app.papershift.com/public_api/v1/working_sessions
MethodGET
ParametersParameters | Type | Required |
---|---|---|
api_token | String | required |
range_start | String (use ISO) | required |
range_end | String (use ISO) | optional |
user_id | Integer | optional |
user_external_id | String | optional |
page | Integer | optional |
tags | String (must contain comma-separated tag IDs and/or zero for Time Tracking without tags) | optional |
company_id | Integer | required if ‚tags‘ is specified and ‚company_external_id‘ is not specified |
company_external_id | String | required if ‚tags‘ is specified and ‚company_id‘ is not specified |
A successful request returns an array of the n-th 25 time tracking entry depending on the page param. You can also pass a user’s external - or record ID to only query for time tracking entries of this specific user.
It is possible to pass a list of tag IDs to only query time tracking entries with tags specified by the given IDs. The list of tags IDs can also contain a zero to include time tracking entries without any tags. The list of tag IDs must be a comma-separated string which must contain positive integers including zero, e.g. ‚3,7,15,0,8‘. When using the ‚tags‘ attribute, ‚company_id‘ or ‚company_external_id‘ must also be specified.
Example{
"api_token": "XXXX",
"range_start": "2015-10-01",
"range_end": "2015-10-31",
"user_external_id": "User-001",
"user_id": 5,
"page": 1
}
function getWorkingSessions() {
var api_token = "XXXX";
var range_start = "2015-10-01";
var range_end = "2015-10-31";
var page = 1;
$.ajax({
url: "https://app.papershift.com/public_api/v1/working_sessions?api_token=" + api_token + "&range_start=" + range_start + "&range_end=" + range_end + "&page=" + page,
type: 'GET',
dataType: 'json',
complete: function (data) {
console.log(data.responseText);
}
});
}
{
"working_sessions": [
{
"id": 1491029,
"starts_at": "2015-10-31T09:15:00+01:00",
"ends_at": "2015-10-31T18:45:00+01:00",
"updated_at": "2015-11-19T19:23:27+00:00",
"location_id": 8006,
"employee_id": 1,
"break_time": 3000,
"confirmed": false,
"last_edit_by": 200178
}
],
"next_page": "https://app.papershift.com/public_api/v1/working_sessions?api_token=XXXX&range_start=2015-10-01&range_end=2015-10-31&page=2
}
Confirm existing Time Tracking
Confirm an existing time tracking entry in your Papershift account
URLhttps://app.papershift.com/public_api/v1/working_sessions/confirm
MethodPUT
ParametersParameters | Type | Required |
---|---|---|
api_token | String | required |
id | Integer | required |
external_id | String | required if id not set |
Confirming an existing time tracking entry requires finding the specific record in the database. This can be achieved via the time tracking entry’s external ID or record ID.
Example{
"api_token": "XXXX",
"working_session": {
"id": "34567"
}
}
{
"ends_at": "2019-06-30T17:00:00+02:00",
"id": 34567,
"starts_at": "2019-06-30T09:00:00+02:00",
"updated_at": "2019-07-01T09:57:07+02:00",
"location_id": 234,
"employee_id": 987654,
"breaks": [],
"break_time": 1800,
"start_signature_id": null,
"end_signature_id": null,
"secure_id": "c3a17ab82e1f1782e1bb599b4550eac0",
"filters": []
}
Delete an existing Time Tracking
Delete an existing time tracking entry in your Papershift account
URLhttps://app.papershift.com/public_api/v1/working_sessions
MethodDELETE
ParametersParameters | Type | Required |
---|---|---|
api_token | String | required |
id | Integer | required |
external_id | String | required if id not set |
Deleting an existing time tracking entry requires finding the specific record in the database. This can be achieved via the time tracking entry’s external ID or record ID.
Example{
"api_token": "XXXX",
"working_session": {
"external_id": "WorkingSession-001"
}
}
function updateWorkingSession() {
var params = {
"api_token": "XXXX",
"working_session": {
"external_id": "WorkingSession-001"
}
};
$.ajax({
url: "https://app.papershift.com/public_api/v1/working_sessions",
type: 'DELETE',
dataType: 'json',
data: JSON.stringify(params),
complete: function (data) {
console.log(data.responseText);
}
});
}
Response 200 (application/json)
Updated 19 days ago