Working Session Actions (beta)



Create a new Working Session Action

Creates a new Working Session Action of the type "start", "start-break", "end-break" or "end".

URL

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

Method

POST

Parameters

Parameters

Type

Required

api_token

String

required

location_id

Integer

required

location_external_id

String

required if location_id is not set

action_type

String

required

action_time

String (user ISO)

required

user_id

Integer

required

user_external_id

String

required if user_id is not set

Example

{
  "api_token": "6ooIiSZaiBwaFBLxveJkm7pP8uTOPLPSwDL6QsOK",
  "working_session_action": {
    "action_type": "end",
    "action_time": "2016-06-02T17:00:00Z",
    "user_id": "145",
    "location_external_id": "Company-A"
  }
}
function createWorkingSessionAction() {
        var params = {
          "api_token": "rJkAk7Bzm5uDipfJY9aZtWhHxfsz06oO5ggJyvI7",
          "working_session_action": {
            "action_type": "end",
                    "action_time": "2016-06-02T17:00:00Z",
                    "user_id": "145",
                    "location_external_id": "Company-A"
          }
        };
  
        $.ajax({
          url: "https://app.papershift.com/public_api/v1/actions",
          type: 'POST',
          dataType: 'json',
          data: JSON.stringify(params),
          complete: function (data) {
            console.log(data.responseText);
          }
        });
      }
{
    "action_time": "2016-06-02T17:00:00Z",
    "action_type": "end",
    "id": "4153bcdf-7398-4835-ba32-045a61a757f7",
    "location_external_id": "Company-A",
    "user_id": "145"
 }

Get Working Session Actions in range

Get Working Session Actions within a specific time range.

URL

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

Method

GET

Parameters

Parameters

Type

Required

api_token

String

required

location_id

Integer

required

location_external_id

String

required if location_id is not set

range_start

String (use ISO)

required

range_end

String (use ISO)

required

user_id

Integer

optional

user_external_id

String

optional if user_id is not set

Example

{
  "api_token": "6ooIiSZaiBwaFBLxveJkm7pP8uTOPLPSwDL6QsOK",
    "range_start": "2016-06-02T17:00:00Z",
    "range_end": "2017-06-03T17:00:00Z",
    "user_id": "145",
    "location_external_id": "Company-A"
}
function getWorkingSessionActions() {
        var api_token = "rJkAk7Bzm5uDipfJY9aZtWhHxfsz06oO5ggJyvI7";
        var range_start = "2015-10-01";
        var range_end = "2017-10-31";
            var location_external_id = "Company-A";
            var user_id = "145";
        var page = 1;
  
        $.ajax({
          url: "https://app.papershift.com/public_api/v1/actions?api_token=" + api_token + "&range_start=" + range_start + "&range_end=" + range_end + "&location_external_id=" + location_external_id + "&user_id=" + user_id + "&page=" + page,
          type: 'GET',
          dataType: 'json',
          complete: function (data) {
            console.log(data.responseText);
          }
        });
      }
{
  "actions": [
    {
            "action_time": "2016-06-02T17:00:00Z",
            "action_type": "end",
            "location_id": "65894",
            "user_id": "145",
      "id": "4153bcdf-7398-4835-ba32-045a61a757f7"
    },
    {
            "action_time": "2016-07-02T18:00:00Z",
            "action_type": "start",
            "location_id": "65834",
            "user_id": "135",
      "id": "41qwecdf-2398-4235-2332-045678a757f7"
    }
  ],
  "page_number": "1",
  "total_pages": "1"
}



Delete an existing Working Session Action

Delete an existing Working Session Action of the type "start", "start-break", "end-break" or "end".

URL

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

Method

DELETE

Parameters

Parameters

Type

Required

api_token

String

required

id

String

required

Example

{
  "api_token": "6ooIiSZaiBwaFBLxveJkm7pP8uTOPLPSwDL6QsOK",
  "working_session_action": {
    "id": "4153bcdf-7398-4835-ba32-045a61a757f7"
  }
}
function deleteWorkingSessionAction() {
        var params = {
          "api_token": "rJkAk7Bzm5uDipfJY9aZtWhHxfsz06oO5ggJyvI7",
          "working_session_action": {
            "id": "4153bcdf-7398-4835-ba32-045a61a757f7"
          }
        };
  
        $.ajax({
          url: "https://app.papershift.com/public_api/v1/actions",
          type: 'DELETE',
          dataType: 'json',
          data: JSON.stringify(params),
          complete: function (data) {
            console.log(data.responseText);
          }
        });
      }
{
    "action_time": "2016-06-02T17:00:00Z",
    "action_type": "end",
    "location_id": "65894",
    "user_id": "145",
  "id": "4153bcdf-7398-4835-ba32-045a61a757f7"
}