Shifts

The API- functions for Shifts in Papershift



Create a new Shift

Creates a new Shift in your Papershift Account

URL

https://app.papershift.com/public_api/v1/shifts

Method

POST

Parameters

ParameterTypeRequired
api_tokenStringrequired
location_idIntegerrequired
location_external_idStringrequired if location_id is not set
working_area_idIntegerrequired
working_area_external_idStringrequired if working_area_id is not set
starts_atString (use ISO)required
ends_atString (use ISO)required
number_of_employeesIntegerrequired
noteStringoptional
visibleBooleanoptional
tagsStringoptional

Information

Creating Shifts requires a valid Location and Working Area
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": "6ooIiSZaiBwaFBLxveJkm7pP8uTOPLPSwDL6QsOK",
        "shift": {
          "location_external_id":     "Company-A",
          "working_area_external_id": "Area-Alpha",
          "starts_at":                "2016-06-02T07:00:00Z",
          "ends_at":                  "2016-06-02T17:00:00Z",
          "number_of_employees":      3,
          "tags": "3,7,15"
        }
      }
function createShift() {
        var params = {
          "api_token": "6ooIiSZaiBwaFBLxveJkm7pP8uTOPLPSwDL6QsOK",
          "shift": {
            "location_external_id":     "Company-A",
            "working_area_external_id": "Area-Alpha",
            "starts_at":                "2016-06-02T07:00:00Z",
            "ends_at":                  "2016-06-02T17:00:00Z",
            "number_of_employees":      3,
            "tags": "3,7,15"
          }
        };
  
        $.ajax({
          url: "https://app.papershift.com/public_api/v1/shifts",
          type: 'POST',
          dataType: 'json',
          data: JSON.stringify(params),
          complete: function (data) {
            console.log(data.responseText);
          }
        });
      }
{
        "id": 747,
        "company_id": 60,
        "working_area_id": 74
        "starts_at": "2016-06-02T07:00:00Z",
        "ends_at": "2016-06-02T17:00:00Z",
        "number_of_employees": 3,
        "note": null,
        "outlook_id": null,
        "shift_id": null,
        "user_shift": null,
        "visible": null,
        "edited": false,
        "created_at": "2016-06-07T09:59:13Z",
        "updated_at": "2016-06-07T09:59:13Z",
        "tags": [
            {
              "id": 3,
            "title": "Tag 3",
            "active": true,
            "external_id": null
           },
          {
              "id": 7,
            "title": "Tag 7",
            "active": true,
            "external_id": null
           },
          {
              "id": 15,
            "title": "Tag 15",
            "active": true,
            "external_id": null
           }
                ]
}



Update an existing Shift

Update an existing Shift in your Papershift Account

URL

https://app.papershift.com/public_api/v1/shifts

Method

PUT

Parameters

ParameterTypeRequired
api_tokenStringrequired
idIntegerrequired
starts_atString (use ISO)required
ends_atString (use ISO)required
number_of_employeesIntegerrequired
noteStringoptional
visibleBooleanoptional
tagsStringoptional

Information

To update an existing Shift requires finding the specific
record in the Database. This can be achieved via the Shift’s Record-ID.

Example

{
        "api_token": "6ooIiSZaiBwaFBLxveJkm7pP8uTOPLPSwDL6QsOK",
        "shift": {
          "id": 745,
          "starts_at": "2016-06-06T07:00:00Z",
          "ends_at": "2016-06-06T17:00:00Z",
          "number_of_employees": 5,
          "tags": "3"
        }
      }
function updateShift() {
        var params = {
          "api_token": "6ooIiSZaiBwaFBLxveJkm7pP8uTOPLPSwDL6QsOK",
          "shift": {
            "id": 745,
            "starts_at": "2016-06-06T07:00:00Z",
            "ends_at": "2016-06-06T17:00:00Z",
            "number_of_employees": 5,
            "tags": "3"
          }
        };
  
        $.ajax({
          url: "https://app.papershift.com/public_api/v1/shifts",
          type: 'PUT',
          dataType: 'json',
          data: JSON.stringify(params),
          complete: function (data) {
            console.log(data.responseText);
          }
        });
      }
{
        "id": 745,
        "company_id": 60,
        "working_area_id": 34
        "starts_at": "2016-06-06T07:00:00Z",
        "ends_at": "2016-06-06T17:00:00Z",
        "number_of_employees": 5,
        "note": null,
        "outlook_id": null,
        "shift_id": null,
        "user_shift": null,
        "visible": null,
        "edited": false,
        "created_at": "2016-06-06T12:26:08Z",
        "updated_at": "2016-06-06T12:26:08Z",
            "tags": [
           {
            "id": 3,
            "title": "Tag 3",
            "active": true,
            "external_id": null
           }
        ]
}



Get Shift by ID

Get Shift by its unique ID or external ID

URL

https://app.papershift.com/public_api/v1/shifts

Method

GET

Parameters

ParametersTypeRequired
api_tokenstringrequired
idintegerrequired (if external_id not set)
external_idstringrequired (if id not set)

Example

{
    "api_token": "XXXX",
    "id": 83201907
}
{
    "company_id": 72214,
    "created_at": "2019-07-10T10:38:02+02:00",
    "ends_at": "2019-07-03T17:00:00+02:00",
    "exact_pause_duration": null,
    "id": 83201907,
    "import_id": null,
    "number_of_employees": 1,
    "outlook_id": null,
    "recurrence_id": null,
    "remove": false,
    "starts_at": "2019-07-03T13:00:00+02:00",
    "status": null,
    "updated_at": "2019-07-10T14:32:23+02:00",
    "uuid": "15c65589-4a2a-4b84-b537-0f36fef61a41",
    "working_area_id": 164359
}



Get Shifts in Range

Get existing Shift(s) in range from your Papershift Account

URL

https://app.papershift.com/public_api/v1/shifts

Method

GET

Parameters

ParameterTypeRequired
api_tokenStringrequired
location_idIntegerrequired
location_external_idStringrequired if location_id is not set
working_area_idIntegeroptional
working_area_external_idStringoptional if working_area_id is not set
range_start (just Date)String (use ISO)required
range_end (just Date)String (use ISO)required
pageIntegeroptional
tagsString, must contain comma-separated tag IDs and/or zero for Shifts without tagsoptional

Information

A Successful Request returns an Array of the n-th 25 Shifts
depending on the Page-Param. You can also pass a Working Area’s External-
or Record-ID to only query for Shifts of this specific Working Area.
When setting the visible_only param to true, only visible Shifts are shown.

It is possible to pass a list of tag IDs to only query Shifts
with tags specified by the given IDs. The list of tags IDs can also
contain a zero to include Shifts without any tags. The list of
tag IDs must be a comma-separated string that must contain positive
integers including zero, e.g. ‚3,7,15,0,8‘.

Example

{
        "api_token" : "6ooIiSZaiBwaFBLxveJkm7pP8uTOPLPSwDL6QsOK",
        "location_external_id": "Company-A",
        "range_start": "2016-06-01",
        "range_end": "2016-06-30"
      }
function getShifts() {
        var api_token = "6ooIiSZaiBwaFBLxveJkm7pP8uTOPLPSwDL6QsOK";
        var location_external_id = "Company-A";
        var range_start = "2016-06-01";
        var range_end = "2016-06-30";
  
        $.ajax({
          url: "https://app.papershift.com/public_api/v1/shifts?api_token=" + api_token + "&location_external_id=" + location_external_id + "&range_start=" + range_start + "&range_end=" + range_end,
          type: 'GET',
          dataType: 'json',
          complete: function (data) {
            console.log(data.responseText);
          }
        });
      }
{
        "shifts": [
          {
            "id": 747,
            "company_id": 60,
            "working_area_id": 74
            "starts_at": "2016-06-02T07:00:00Z",
            "ends_at": "2016-06-02T17:00:00Z",
            "number_of_employees": 3,
            "note": null,
            "outlook_id": null,
            "shift_id": null,
            "user_shift": null,
            "visible": null,
            "edited": false,
            "created_at": "2016-06-07T09:59:13Z",
            "updated_at": "2016-06-07T09:59:13Z",
          },
          {
            "id": 745,
            "company_id": 60,
            "working_area_id": 34
            "starts_at": "2016-06-06T07:00:00Z",
            "ends_at": "2016-06-06T17:00:00Z",
            "number_of_employees": 5,
            "note": null,
            "outlook_id": null,
            "shift_id": null,
            "user_shift": null,
            "visible": null,
            "edited": false,
            "created_at": "2016-06-06T12:26:08Z",
            "updated_at": "2016-06-06T12:26:08Z",
          }
        ],
        "next_page": "http://localhost:5000/public_api/v1/shifts?api_token=6ooIiSZaiBwaFBLxveJkm7pP8uTOPLPSwDL6QsOK&range_start=2016-06-01&range_end=2016-06-30&location_external_id=Company-A"
      }



Delete an existing Shift

Delete an existing Shift in your Papershift Account

URL

https://app.papershift.com/public_api/v1/shifts

Method

DELETE

Parameters

ParameterTypeRequired
api_tokenStringrequired
idIntegerrequired

Information

To delete an existing Shift requires finding the specific
record in the Database. This can be achieved via the Shift’s Record-ID.

Example

{
        "api_token": "6ooIiSZaiBwaFBLxveJkm7pP8uTOPLPSwDL6QsOK",
        "shift": {
          "id": 746
        }
      }
function deleteShift() {
        var params = {
          "api_token": "6ooIiSZaiBwaFBLxveJkm7pP8uTOPLPSwDL6QsOK",
          "shift": {
            "id": 746
          }
        };
  
        $.ajax({
          url: "https://app.papershift.com/public_api/v1/shifts",
          type: 'DELETE',
          dataType: 'json',
          data: JSON.stringify(params),
          complete: function (data) {
            console.log(data.responseText);
          }
        });
      }
Response 200 (application/json)