Users

The API- functions for Users in Papershift



Create a new User

Create a new user in your Papershift account

URL

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

Method

POST

Parameters

ParametersTypeRequired
api_tokenStringrequired
location_idsInteger, comma-separated string for multiple IDsrequired
location_external_idsString, comma-separated for multiple external IDsrequired if location_ids is not set
working_area_idsInteger, comma-separated string for multiple IDsoptional
working_area_external_idsString, comma-separated for multiple external IDsoptional if working_area_ids is not set
usernameStringrequired
emailString (valid format, unique)optional (automatically sends an invitation mail)
abbrevStringoptional
initial_time_accountFloatoptional
salaryFloatoptional
home_officeBooleanoptional
working_sessions_creatorBooleanoptional
staff_numberStringoptional
external_idStringoptional
locale‚de‘ | ‚en‘optional
tagsString, comma-separated string for multiple IDsoptional
data_profilesHashoptional

Information

Creating users requires one or more valid locations and optionally one or more
working areas 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",
  "user": {
    "location_ids": "1",
    "working_area_ids": "2,3",
    "username": "User 1",
    "tags": "1,2,3",
    "locale": "de",
    "home_office": true,
    "salary": "11.9",
    "email": "[email protected]",
    "data_profiles": {
      "birthday": "1980-06-20",
      "desc": "Sample description"
    }
  }
}
function createUser() {
  var params = {
    "api_token": "6ooIiSZaiBwaFBLxveJkm7pP8uTOPLPSwDL6QsOK",
    "user": {
      "location_ids": "1",
      "working_area_ids": "2,3",
      "username": "User 1",
      "tags": "1,2,3",
      "locale": "de",
      "home_office": true,
      "salary": "11.9",
      "email": "[email protected]",
      "data_profiles": {
        "birthday": "1980-06-20",
        "desc": "Sample description"
      }
    }
  };

  $.ajax({
    url: "https://app.papershift.com/public_api/v1/users",
    type: 'POST',
    dataType: 'json',
    data: JSON.stringify(params),
    complete: function (data) {
      console.log(data.responseText);
    }
  });
}
{
  "id": 115,
  "abbrev": null,
  "email": "[email protected]",
  "external_id": null,
  "home_office": true,
  "initial_time_account": 0,
  "locale": "de",
  "salary": 11.9,
  "staff_number": null,
  "username": "User 1",
  "working_sessions_creator": false,
  "enterprise_id": 1,
  "location_ids": [1],
  "working_area_ids": [2, 3],
  "tags": [3, 2, 1],
  "data_profiles": {
    "birthday": {
      "label": "Geburtstag",
      "value": "1980-06-20"
    }
  }
}



Update an existing User

Update an existing user in your Papershift account

URL

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

Method

PUT

Parameters

ParametersTypeRequired
api_tokenStringrequired
idIntegerrequired
external_idStringrequired if id not set
working_area_idsInteger, comma-separated string for multiple IDsoptional
working_area_external_idsString, comma-separated for multiple external IDsoptional if working_area_ids is not set
usernameStringoptional
emailString (valid format, unique)optional
abbrevStringoptional
initial_time_accountFloatoptional
salaryFloatoptional
home_officeBooleanoptional
working_sessions_creatorBooleanoptional
staff_numberStringoptional
locale‚de‘ | ‚en‘optional
tagsString, comma-separated string for multiple IDsoptional
data_profilesHashoptional

Information

Updating an existing user requires finding the specific record
in the database. This can be achieved via the user’s
external ID or record ID.

Example

{
  "api_token": "6ooIiSZaiBwaFBLxveJkm7pP8uTOPLPSwDL6QsOK",
  "user": {
    "id": 112,
    "working_area_ids": "7,3",
    "tags": "1,2",
    "home_office": false,
    "salary": 23,
    "username": "User 2",
    "email": "[email protected]",
    "data_profiles": {
      "birthday": "1980-06-20",
      "desc": "Sample description"
    }
  }
}
function updateUser() {
  var params = {
    "api_token": "6ooIiSZaiBwaFBLxveJkm7pP8uTOPLPSwDL6QsOK",
    "user": {
      "id": 112,
      "working_area_ids": "7,3",
      "tags": "1,2",
      "home_office": false,
      "salary": 23,
      "username": "User 2",
      "email": "[email protected]",
      "data_profiles": {
        "birthday": "1980-06-20",
        "desc": "Sample description"
      }
    }
  };

  $.ajax({
    url: "https://app.papershift.com/public_api/v1/users",
    type: 'PUT',
    dataType: 'json',
    data: JSON.stringify(params),
    complete: function (data) {
      console.log(data.responseText);
    }
  });
}
{
  "abbrev": null,
  "desc": null,
  "email": "[email protected]",
  "external_id": null,
  "home_office": false,
  "id": 112,
  "initial_time_account": 0,
  "locale": "de",
  "salary": 23,
  "staff_number": null,
  "username": "User 2",
  "working_sessions_creator": false,
  "enterprise_id": 1,
  "location_ids": [1],
  "working_area_ids": [7, 3],
  "tags": [2, 1],
  "data_profiles": {
    "birthday": {
      "label": "Geburtstag",
      "value": "1980-06-20"
    }
  }
}



Get User by ID

Get user by its unique ID or external ID

URL

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

Method

GET

Parameters

ParametersTypeRequired
api_tokenstringrequired
idintegerrequired
external_idstringrequired if id is not set

Example

{
    "api_token": "XXXX",
    "id": 327066
}
{
    "abbrev": "cc",
    "email": "[email protected]",
    "external_id": "user_42",
    "home_office": true,
    "id": 327066,
    "initial_time_account": 0,
    "locale": null,
    "salary": 0,
    "staff_number": null,
    "status": "active",
    "username": "Carol",
    "working_sessions_creator": false,
    "enterprise_id": 39246,
    "location_ids": [
        72214
    ],
    "working_area_ids": [
        164359,
        159948,
        159949,
        159950
    ],
    "tags": [],
    "data_profiles": {
        "birthday": {
            "label": "Geburtstag",
            "value": "1994-02-14"
        }
    }
}



Get Users

Get user(s) from your Papershift account

URL

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

Method

GET

Parameters

ParametersTypeRequired
api_tokenStringrequired
location_idsInteger, comma-separated for multiple IDsoptional
location_external_idsString, comma-separated for multiple external IDsoptional if location_ids is not set
working_area_idsInteger, comma-separated for multiple IDsoptional
working_area_external_idsString, comma-separated for multiple external IDsoptional if working_area_ids is not set
tagsString, comma-separated string for multiple IDsoptional
pageIntegeroptional

Information

A successful request returns an array of the n-th 25 users
depending on the page param. You can also pass one or more
working area’s external- or record IDs to only query for users of these
specific working areas. The same for locations: You can pass one or more
location’s external- or record IDs to only query for users in these
specific locations.

It is possible to pass a list of tag IDs to only query users
with tags specified by the given IDs. The list of tags IDs can also
contain a zero to include users 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_ids": "AAA,BBB",
  "working_area_external_ids": "XYZ1,XYZ2",
  "tags": "35,67,158",
  "page": 2
}
function getUsers() {
  var api_token = "6ooIiSZaiBwaFBLxveJkm7pP8uTOPLPSwDL6QsOK";
  var location_external_ids = "AAA,BBB";
  var working_area_external_ids = "XYZ1,XYZ2";
  var tags = "35,67,158";
  var page = 2

  $.ajax({
    url: "https://app.papershift.com/public_api/v1/users?api_token=" + api_token + "&location_external_ids=" + location_external_ids + "&working_area_external_ids=" + working_area_external_ids + "&tags=" + tags + "&page=" + page,
    type: 'GET',
    dataType: 'json',
    complete: function (data) {
      console.log(data.responseText);
    }
  });
}
{
  "users": [
    {
      "abbrev": "",
      "email": "[email protected]",
      "external_id": null,
      "home_office": false,
      "id": 1,
      "initial_time_account": 0,
      "locale": "",
      "salary": 0,
      "staff_number": "",
      "username": "User 10",
      "working_sessions_creator": false,
      "enterprise_id": 371,
      "location_ids": [55, 98],
      "working_area_ids": [235, 375],
      "tags": [35, 67, 158],
      "data_profiles": {
        "birthday": {
          "label": "Geburtstag",
          "value": null
        }
      }
    },
    {
      "abbrev": null,
      "email": "",
      "external_id": null,
      "home_office": false,
      "id": 4,
      "initial_time_account": 0,
      "locale": null,
      "salary": 0,
      "staff_number": null,
      "username": "User 25",
      "working_sessions_creator": false,
      "enterprise_id": 371,
      "location_ids": [55, 98],
      "working_area_ids": [235, 375],
      "tags": [35, 67, 158],
      "data_profiles": {
        "birthday": {
          "label": "Geburtstag",
          "value": "1980-06-20"
        }
      }
    }
  ],
  "next_page": "http://localhost:5000/public_api/v1/users?api_token=6ooIiSZaiBwaFBLxveJkm7pP8uTOPLPSwDL6QsOK&location_external_ids=AAA,BBB&page=3&working_area_external_ids=XYZ1,XYZ2&tags=35,67,158"
}



Delete an existing User

Delete an existing user in your Papershift account

URL

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

Method

DELETE

Parameters

ParameterTypeRequired
api_tokenStringrequired
idIntegerrequired
external_idStringrequired if id not set

Information

Deleting an existing user requires finding the specific record
in the database. This can be achieved via the user’s
external ID or record ID.

Example

{
  "api_token": "6ooIiSZaiBwaFBLxveJkm7pP8uTOPLPSwDL6QsOK",
  "user": {
    "id": 145
  }
}
function deleteUser() {
  var params = {
    "api_token": "6ooIiSZaiBwaFBLxveJkm7pP8uTOPLPSwDL6QsOK",
    "user": {
      "id": 145
    }
  };

  $.ajax({
    url: "https://app.papershift.com/public_api/v1/users",
    type: 'DELETE',
    dataType: 'json',
    data: JSON.stringify(params),
    complete: function (data) {
      console.log(data.responseText);
    }
  });
}
Response 200 (application/json)