{"_id":"56fa046648e69f0e00a77431","title":"Staffjoy Suite API Basics","updates":["611279712cc147005d7e0649","611279904f29cf00342e4903","615c06a4084bde01a8813c6b"],"__v":18,"api":{"results":{"codes":[{"language":"json","code":"{}","name":"","status":200},{"code":"{}","name":"","status":400,"language":"json"}]},"settings":"","url":"","auth":"required","params":[]},"link_external":false,"link_url":"","parentDoc":null,"slug":"getting-started","type":"basic","user":"561aed1a30e7490d0022d6ae","version":"56fa046648e69f0e00a7742f","sync_unique":"","body":"The Staffjoy API controls access to all data within the application. Staffjoy's applications use this API for all functionality, and we invite developers to build their own API integrations with our system. \n\nThe Staffjoy API uses [REST](https://en.wikipedia.org/wiki/Representational_state_transfer), and data is encoded in [JSON](http://www.json.org/). Resources are logically structured, and IDs are integers.\n\n\nOur team supports developers using our API. Please email us at [[email protected]](mailto:[email protected]) with any questions. We can help with design questions, debugging, and setting up sandbox accounts.\n\n## Mailing List\n\nIf you develop on the Staffjoy API, please join the [Staffjoy API Mailing List](https://groups.google.com/forum/#!forum/staffjoy-api-updates) for important news about changes or deprecations. \n\n## Envelope\n\n`GET` endpoints return information in an envelope with the key `\"data\"`. This allows us to package metadata in certain circumstances with responses, such as pagination. \n\n## Allowed Methods\n\nThe Staffjoy API uses standard `GET`, `POST`, `PATCH`, and `DELETE` methods to modify endpoints. Note that we support `PATCH` in favor of `PUT`.\n\n## Errors\n\nStaffjoy uses standard HTTP status codes to communicate errors. The response body is JSON-encoded, and may include a `\"message\"` key with further information about the failure.\n\nCommon codes used by our API include:\n[block:parameters]\n{\n \"data\": {\n \"h-0\": \"HTTP Status Code\",\n \"h-1\": \"Status\",\n \"0-0\": \"200 - OK\",\n \"0-1\": \"API call successful\",\n \"1-0\": \"201 - Created\",\n \"1-1\": \"The resource was created\",\n \"2-0\": \"204 - Success No Content\",\n \"2-1\": \"The request succeeded and there is no response data. Often used for DELETE endpoints.\",\n \"3-0\": \"400 - Bad Request\",\n \"3-1\": \"The request failed, likely due to invalid or missing parameters. Check for a `\\\"message\\\"` value in the response with further details.\",\n \"4-0\": \"401 - Unauthorized\",\n \"4-1\": \"The API key did not have permission to complete this action. In some cases, an alternative endpoint may exist for security purposes - please contact support if you have questions.\",\n \"5-0\": \"404 - Not Found\",\n \"5-1\": \"The resource does not exist\",\n \"6-0\": \"429 - Too Many Request\",\n \"6-1\": \"The API Key was rate-limited due to too many requests. See below for rate limit information.\",\n \"7-0\": \"500- Server Error\",\n \"7-1\": \"Staffjoy's API encountered an unexpected error. Please email support for help\",\n \"8-0\": \"502, 503 - Service Error\",\n \"8-1\": \"Staffjoy's API encountered an intermittent error -please try again.\"\n },\n \"cols\": 2,\n \"rows\": 9\n}\n[/block]\n## Client Libraries\n\nStaffjoy currently has one official client library in Python. [Learn more on Github](https://github.com/Staffjoy/client_python) or install it via `pip install staffjoy`.\n\n## Datetime Handling\n\nAll datetime objects in Staffjoy use [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) formatting. For datetime objects without a specified offset, [UTC (Coordinated Universal Time)])https://en.wikipedia.org/wiki/Coordinated_Universal_Time) is assumed.\n\n## Rate Limiting\n\nStaffjoy's API limits each IP address and each API key to **300 requests per minute***. Exceeding this limit will result in a `429 - Too Many Requests` error. If you require a higher limit, please contact support.\n\n## Pagination\n\nFor some group endpoints, we use a `limit` and `offset` variables to handle pagination. Lists are sorted by ID, ascending. The `limit` controls how many items are returned, and the `offset` specifies the beginning of the search window. \n\nSo, to search a 75-item list, you may query an endpoint 3 times, each with `limit` of 25, and with `offset` of 0, 25, and 50.","hidden":false,"isReference":false,"next":{"description":"","pages":[]},"order":0,"project":"56f9fe2cf9102d0e00ca623e","category":"56fa046648e69f0e00a77430","createdAt":"2016-03-29T04:01:48.523Z","excerpt":"","githubsync":"","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
Staffjoy Suite API Basics
The Staffjoy API controls access to all data within the application. Staffjoy's applications use this API for all functionality, and we invite developers to build their own API integrations with our system.
The Staffjoy API uses REST, and data is encoded in JSON. Resources are logically structured, and IDs are integers.
Our team supports developers using our API. Please email us at [email protected] with any questions. We can help with design questions, debugging, and setting up sandbox accounts.
Mailing List
If you develop on the Staffjoy API, please join the Staffjoy API Mailing List for important news about changes or deprecations.
Envelope
GET
endpoints return information in an envelope with the key "data"
. This allows us to package metadata in certain circumstances with responses, such as pagination.
Allowed Methods
The Staffjoy API uses standard GET
, POST
, PATCH
, and DELETE
methods to modify endpoints. Note that we support PATCH
in favor of PUT
.
Errors
Staffjoy uses standard HTTP status codes to communicate errors. The response body is JSON-encoded, and may include a "message"
key with further information about the failure.
Common codes used by our API include:
200 - OK
API call successful
201 - Created
The resource was created
204 - Success No Content
The request succeeded and there is no response data. Often used for DELETE endpoints.
400 - Bad Request
The request failed, likely due to invalid or missing parameters. Check for a "message"
value in the response with further details.
401 - Unauthorized
The API key did not have permission to complete this action. In some cases, an alternative endpoint may exist for security purposes - please contact support if you have questions.
404 - Not Found
The resource does not exist
429 - Too Many Request
The API Key was rate-limited due to too many requests. See below for rate limit information.
500- Server Error
Staffjoy's API encountered an unexpected error. Please email support for help
502, 503 - Service Error
Staffjoy's API encountered an intermittent error -please try again.
Client Libraries
Staffjoy currently has one official client library in Python. Learn more on Github or install it via pip install staffjoy
.
Datetime Handling
All datetime objects in Staffjoy use ISO 8601 formatting. For datetime objects without a specified offset, [UTC (Coordinated Universal Time)])https://en.wikipedia.org/wiki/Coordinated_Universal_Time) is assumed.
Rate Limiting
Staffjoy's API limits each IP address and each API key to 300 requests per minute*. Exceeding this limit will result in a 429 - Too Many Requests
error. If you require a higher limit, please contact support.
Pagination
For some group endpoints, we use a limit
and offset
variables to handle pagination. Lists are sorted by ID, ascending. The limit
controls how many items are returned, and the offset
specifies the beginning of the search window.
So, to search a 75-item list, you may query an endpoint 3 times, each with limit
of 25, and with offset
of 0, 25, and 50.
{"_id":"56fa18ee4e00c80e000f275d","api":{"url":"","auth":"required","params":[],"results":{"codes":[{"language":"json","code":"{}","name":"","status":200},{"status":400,"language":"json","code":"{}","name":""}]},"settings":""},"category":"56fa046648e69f0e00a77430","excerpt":"","user":"561aed1a30e7490d0022d6ae","body":"API authentication in Staffjoy are currently tied to a user account. \n\nWe offer both permanent api keys and time-based tokens. \n\n## API Keys\n\nIssue an API key while logged in through [API Keys on the My Account page](https://www.staffjoy.com/auth/api-keys). \n\nAssign a label while issuing the token in order to keep track of what it is being used for. The key will be shown once, after which it will never be shown again. You will receive an email that the key has been issued. \n\nThrough this page, you may also view issued keys, see the last time they were used, and revoke them. \n\nAPI keys do not expire. API keys may be revoked. The API key has the permissions of the associated user, and actions appear as if they were that user. If the associated user has its permissions changed, such as being removed from an organization, then the functionality of the key will change. \n\nWe recommend that different systems have different API keys for security purposes. \n\n## Time-Based Tokens\n\nStaffjoy supports time-based tokens that expire after a set amount of time. These tokens are tied to the user session, and used primarily in our applications. If you require access to this method of authentication, please contact support.","link_external":false,"title":"Authentication","updates":[],"slug":"authentication","sync_unique":"","__v":2,"githubsync":"","project":"56f9fe2cf9102d0e00ca623e","order":1,"parentDoc":null,"type":"basic","version":"56fa046648e69f0e00a7742f","createdAt":"2016-03-29T05:55:58.424Z","hidden":false,"isReference":false,"link_url":"","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
Authentication
API authentication in Staffjoy are currently tied to a user account.
We offer both permanent api keys and time-based tokens.
API Keys
Issue an API key while logged in through API Keys on the My Account page.
Assign a label while issuing the token in order to keep track of what it is being used for. The key will be shown once, after which it will never be shown again. You will receive an email that the key has been issued.
Through this page, you may also view issued keys, see the last time they were used, and revoke them.
API keys do not expire. API keys may be revoked. The API key has the permissions of the associated user, and actions appear as if they were that user. If the associated user has its permissions changed, such as being removed from an organization, then the functionality of the key will change.
We recommend that different systems have different API keys for security purposes.
Time-Based Tokens
Staffjoy supports time-based tokens that expire after a set amount of time. These tokens are tied to the user session, and used primarily in our applications. If you require access to this method of authentication, please contact support.
{"_id":"57195b39ac1e2e0e001834f5","__v":7,"project":"56f9fe2cf9102d0e00ca623e","user":"561aed1a30e7490d0022d6ae","slug":"page","title":"Current Session and Access","type":"get","version":"56fa046648e69f0e00a7742f","body":"[block:code]\n{\n \"codes\": [\n {\n \"code\": \"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/\",\n \"language\": \"curl\"\n }\n ]\n}\n[/block]\nThis endpoint shows information about the current session and the accounts that are able to be accessed.\n\nThe `access` parameter denotes the different permissions that the current user has access to. It also provides the necessary IDs to access the relevant data. For example, each worker option includes `organization_id`, `location_id`, `role_id`, and `user_id`. These IDs can then be used to complete the route for the Worker API:\n`organizations/<organization_id>/locations/<location_id>/roles/<role_id>/users/<user_id>/`","createdAt":"2016-04-21T22:59:05.627Z","excerpt":"Current Session","hidden":false,"api":{"settings":"","url":"/","auth":"required","examples":{"codes":[]},"method":"get","params":[],"results":{"codes":[{"language":"json","code":"{\n \"access\": {\n \"sudo\": true,\n \"worker\": [\n {\n \"organization_id\": 1,\n \"user_id\": 2718,\n \"location_id\": 6,\n \"role_id\": 656\n }\n ],\n \"location_manager\": [\n {\n \"organization_id\": 1,\n \t\"location_id\": 6,\n }\n ],\n \"organization_admin\": [\n {\n \"organization_id\": 1\n }\n ]\n },\n \"data\": {\n \"username\": \"leonhard\",\n \"confirmed\": true,\n \"name\": \"Leonhard Euler\",\n \"active\": true,\n \"member_since\": \"2015-02-14T20:53:31\",\n \"last_seen\": \"2016-05-06T19:38:06.951111\",\n \"sudo\": false,\n \"email\": \"[email protected]\",\n \"id\": 2718,\n \t\"phone_number\": \"+14435783359\",\n },\n \"resources\": [\n \"users\",\n \"organizations\"\n ]\n}","name":"","status":200}]}},"githubsync":"","order":0,"parentDoc":null,"link_url":"","sync_unique":"","updates":[],"category":"56fa15143130030e0081ba0a","isReference":false,"link_external":false,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
getCurrent Session and Access
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/
This endpoint shows information about the current session and the accounts that are able to be accessed.
The access
parameter denotes the different permissions that the current user has access to. It also provides the necessary IDs to access the relevant data. For example, each worker option includes organization_id
, location_id
, role_id
, and user_id
. These IDs can then be used to complete the route for the Worker API:organizations/<organization_id>/locations/<location_id>/roles/<role_id>/users/<user_id>/
Definition
Result Format
{
"access": {
"sudo": true,
"worker": [
{
"organization_id": 1,
"user_id": 2718,
"location_id": 6,
"role_id": 656
}
],
"location_manager": [
{
"organization_id": 1,
"location_id": 6,
}
],
"organization_admin": [
{
"organization_id": 1
}
]
},
"data": {
"username": "leonhard",
"confirmed": true,
"name": "Leonhard Euler",
"active": true,
"member_since": "2015-02-14T20:53:31",
"last_seen": "2016-05-06T19:38:06.951111",
"sudo": false,
"email": "[email protected]",
"id": 2718,
"phone_number": "+14435783359",
},
"resources": [
"users",
"organizations"
]
}
{"_id":"571e5ff1fa79a4190004edf2","__v":1,"githubsync":"","hidden":false,"isReference":false,"order":0,"type":"get","user":"561da5369ace800d00289ea3","api":{"auth":"required","examples":{"codes":[{"language":"curl","code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/users/\n"}]},"method":"get","params":[{"_id":"56fa13063130030e0081ba09","ref":"","required":false,"desc":"Returns items (offset) to (offset + limit) - inclusive to exclusive - based on the sorted organization id.","default":"0","type":"int","name":"offset","in":"query"},{"in":"query","_id":"56fa13063130030e0081ba08","ref":"","required":false,"desc":"Number of results to return","default":"25","type":"int","name":"limit"},{"ref":"","required":false,"desc":"Returns results that are similar to the given username","default":"","type":"string","name":"filterByUsername","in":"query","_id":"571e608efa79a4190004edf5"},{"required":false,"desc":"Returns results that are similar to the given email address","default":"","type":"string","name":"filterByEmail","in":"query","_id":"571e608efa79a4190004edf4","ref":""}],"results":{"codes":[{"name":"","code":"{\n \"data\": [\n {\n \"username\": \"tesla\",\n \"confirmed\": true,\n \"name\": \"Nikola Tesla\",\n \"active\": true,\n \"member_since\": \"2015-02-14T20:53:31\",\n \"last_seen\": \"2016-04-25T18:23:00\",\n \"sudo\": true,\n \"email\": \"[email protected]\",\n \"id\": 1,\n \"phone_number\": \"\"\n },\n {\n \"username\": \"rosalind\",\n \"confirmed\": true,\n \"name\": \"Rosalind Franklin\",\n \"active\": true,\n \"member_since\": \"2015-02-14T20:53:31\",\n \"last_seen\": \"2016-04-25T18:23:38.704586\",\n \"sudo\": true,\n \"email\": \"[email protected]\",\n \"id\": 2,\n \"phone_number\": \"+14435783359\"\n },\n ],\n \"limit\": 25,\n \"filters\": {\n \"filterByUsername\": null,\n \"filterByEmail\": null\n },\n \"offset\": 0\n}","language":"json","status":200}]},"settings":"","url":"/users/"},"body":"[block:callout]\n{\n \"type\": \"warning\",\n \"title\": \"Only Staffjoy support may access this endpoint\",\n \"body\": \"\"\n}\n[/block]\nTo get your User ID, visit the [Base Endpoint](doc:page)","project":"56f9fe2cf9102d0e00ca623e","slug":"all-users","category":"56fbf8c44c3cea190015da0f","editedParams":true,"excerpt":"","link_external":false,"link_url":"","parentDoc":null,"updates":[],"createdAt":"2016-04-25T18:20:33.992Z","editedParams2":true,"sync_unique":"","title":"All Users","version":"56fa046648e69f0e00a7742f","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
getAll Users
Query Params
Only Staffjoy support may access this endpoint
To get your User ID, visit the Base Endpoint
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/users/
Result Format
{
"data": [
{
"username": "tesla",
"confirmed": true,
"name": "Nikola Tesla",
"active": true,
"member_since": "2015-02-14T20:53:31",
"last_seen": "2016-04-25T18:23:00",
"sudo": true,
"email": "[email protected]",
"id": 1,
"phone_number": ""
},
{
"username": "rosalind",
"confirmed": true,
"name": "Rosalind Franklin",
"active": true,
"member_since": "2015-02-14T20:53:31",
"last_seen": "2016-04-25T18:23:38.704586",
"sudo": true,
"email": "[email protected]",
"id": 2,
"phone_number": "+14435783359"
},
],
"limit": 25,
"filters": {
"filterByUsername": null,
"filterByEmail": null
},
"offset": 0
}
{"_id":"571e60106597412b008b593e","excerpt":"","link_external":false,"title":"Create User","type":"post","user":"561da5369ace800d00289ea3","api":{"auth":"required","examples":{"codes":[{"code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/users/ -X POST -d \"[email protected]\"","language":"curl"}]},"method":"post","params":[{"in":"body","_id":"56fa17c675bb290e001e68b9","ref":"","required":true,"desc":"The email address of the person being created","default":"","type":"string","name":"email"},{"name":"name","in":"body","_id":"56fa17c675bb290e001e68ba","ref":"","required":false,"desc":"The name of the person being created","default":"","type":"string"}],"results":{"codes":[{"language":"json","code":"{\n \"username\": null,\n \"confirmed\": false,\n \"name\": null,\n \"active\": false,\n \"member_since\": \"2016-04-25T18:39:08\",\n \"last_seen\": \"2016-04-25T18:39:08\",\n \"sudo\": false,\n \"email\": \"[email protected]\",\n \"id\": 1335\n}","name":"","status":201}]},"settings":"","url":"/users/"},"createdAt":"2016-04-25T18:21:04.480Z","link_url":"","slug":"create-user","version":"56fa046648e69f0e00a7742f","category":"56fbf8c44c3cea190015da0f","editedParams":true,"editedParams2":true,"parentDoc":null,"project":"56f9fe2cf9102d0e00ca623e","updates":[],"githubsync":"","hidden":false,"order":1,"sync_unique":"","__v":1,"body":"[block:callout]\n{\n \"type\": \"warning\",\n \"title\": \"Only Staffjoy support may access this endpoint\",\n \"body\": \"New users can also be created through the Admins or Role Workers endpoints.\"\n}\n[/block]","isReference":false,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
postCreate User
Body Params
Only Staffjoy support may access this endpoint
New users can also be created through the Admins or Role Workers endpoints.
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/users/ -X POST -d "[email protected]"
Result Format
{
"username": null,
"confirmed": false,
"name": null,
"active": false,
"member_since": "2016-04-25T18:39:08",
"last_seen": "2016-04-25T18:39:08",
"sudo": false,
"email": "[email protected]",
"id": 1335
}
{"_id":"571e601e92d3701900706eca","editedParams":true,"excerpt":"","type":"get","user":"561da5369ace800d00289ea3","parentDoc":null,"slug":"user","updates":[],"version":"56fa046648e69f0e00a7742f","api":{"params":[{"name":"user_id","in":"path","_id":"56fbfb9e587e43170081eb61","ref":"","required":true,"desc":"ID of the user","default":"","type":"int"},{"name":"archived","ref":"","required":false,"type":"boolean","in":"query","_id":"571e6c2e6597412b008b5955","default":"","desc":"filter the role_members response by whether the worker's archived property"}],"results":{"codes":[{"name":"","code":"{\n \"role_member\": [\n {\n \"max_hours_per_workday\": 8,\n \"archived\": false,\n \"enable_timeclock\": true,\n \"name\": \"Hackers\",\n \"max_consecutive_workdays\": 6,\n \"min_hours_between_shifts\": 12,\n \"enable_time_off_requests\": false,\n \"location_id\": 250,\n \"id\": 478,\n \"min_hours_per_workday\": 4,\n \"location\": {\n \"organization_id\": 180,\n \"timezone\": \"America/Los_Angeles\",\n \"archived\": false,\n \"id\": 250,\n \"name\": \"San Francisco\"\n },\n \"organization\": {\n \"workers_can_claim_shifts_in_excess_of_max\": false,\n \"paid\": true,\n \"trial_days\": 30,\n \"enable_time_off_requests_default\": false,\n \"plan\": \"boss-v2\",\n \"active\": true,\n \"early_access\": false,\n \"id\": 180,\n \"shifts_assigned_days_before_start\": 4,\n \"name\": \"Staffjoy Example 1\",\n \"day_week_starts\": \"monday\",\n \"created_at\": \"2015-06-15T03:00:32\",\n \"paid_until\": \"2030-06-15T00:00:00\",\n \"enable_timeclock_default\": true,\n \"enable_shiftplanning_export\": false\n }\n }\n ],\n \"data\": {\n \"username\": null,\n \"confirmed\": true,\n \"name\": \"Nikola Tesla\",\n \"active\": true,\n \"member_since\": \"2015-11-08T23:05:26\",\n \"last_seen\": \"2016-04-25T18:44:02\",\n \"sudo\": false,\n \"email\": \"[email protected]\",\n \"id\": 1,\n \"phone_number\": \"+14435783359\"\n },\n \"resources\": [\n \t\t\"apikeys\",\n \t\"sessions\",\n ],\n \"organization_admin\": [\n {\n \"workers_can_claim_shifts_in_excess_of_max\": false,\n \"paid\": true,\n \"trial_days\": 30,\n \"enable_time_off_requests_default\": false,\n \"plan\": \"boss-v2\",\n \"active\": true,\n \"early_access\": false,\n \"id\": 180,\n \"shifts_assigned_days_before_start\": 4,\n \"name\": \"Staffjoy Example 1\",\n \"day_week_starts\": \"monday\",\n \"created_at\": \"2015-06-15T03:00:32\",\n \"paid_until\": \"2030-06-15T00:00:00\",\n \"enable_timeclock_default\": true,\n \"enable_shiftplanning_export\": false\n }\n ],\n \t\t\"location_manager\": [],\n}","language":"json","status":200}]},"settings":"","url":"/users/:user_id","auth":"required","examples":{"codes":[{"language":"curl","code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/users/2"}]},"method":"get"},"body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Self\"\n}\n[/block]","category":"56fbf8c44c3cea190015da0f","hidden":false,"order":2,"__v":1,"createdAt":"2016-04-25T18:21:18.128Z","isReference":false,"project":"56f9fe2cf9102d0e00ca623e","sync_unique":"","title":"User","editedParams2":true,"githubsync":"","link_external":false,"link_url":"","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
getUser
Path Params
Query Params
Permission Required: Self
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/users/2
Result Format
{
"role_member": [
{
"max_hours_per_workday": 8,
"archived": false,
"enable_timeclock": true,
"name": "Hackers",
"max_consecutive_workdays": 6,
"min_hours_between_shifts": 12,
"enable_time_off_requests": false,
"location_id": 250,
"id": 478,
"min_hours_per_workday": 4,
"location": {
"organization_id": 180,
"timezone": "America/Los_Angeles",
"archived": false,
"id": 250,
"name": "San Francisco"
},
"organization": {
"workers_can_claim_shifts_in_excess_of_max": false,
"paid": true,
"trial_days": 30,
"enable_time_off_requests_default": false,
"plan": "boss-v2",
"active": true,
"early_access": false,
"id": 180,
"shifts_assigned_days_before_start": 4,
"name": "Staffjoy Example 1",
"day_week_starts": "monday",
"created_at": "2015-06-15T03:00:32",
"paid_until": "2030-06-15T00:00:00",
"enable_timeclock_default": true,
"enable_shiftplanning_export": false
}
}
],
"data": {
"username": null,
"confirmed": true,
"name": "Nikola Tesla",
"active": true,
"member_since": "2015-11-08T23:05:26",
"last_seen": "2016-04-25T18:44:02",
"sudo": false,
"email": "[email protected]",
"id": 1,
"phone_number": "+14435783359"
},
"resources": [
"apikeys",
"sessions",
],
"organization_admin": [
{
"workers_can_claim_shifts_in_excess_of_max": false,
"paid": true,
"trial_days": 30,
"enable_time_off_requests_default": false,
"plan": "boss-v2",
"active": true,
"early_access": false,
"id": 180,
"shifts_assigned_days_before_start": 4,
"name": "Staffjoy Example 1",
"day_week_starts": "monday",
"created_at": "2015-06-15T03:00:32",
"paid_until": "2030-06-15T00:00:00",
"enable_timeclock_default": true,
"enable_shiftplanning_export": false
}
],
"location_manager": [],
}
{"_id":"571e602a3c34141700f231c8","body":"[block:callout]\n{\n \"type\": \"warning\",\n \"title\": \"Only Staffjoy support may access this endpoint\"\n}\n[/block]","editedParams":true,"slug":"modify-a-user","category":"56fbf8c44c3cea190015da0f","createdAt":"2016-04-25T18:21:30.249Z","excerpt":"","project":"56f9fe2cf9102d0e00ca623e","type":"patch","user":"561da5369ace800d00289ea3","__v":1,"api":{"params":[{"ref":"","required":false,"desc":"","default":"","type":"string","name":"username","in":"body","_id":"56fbfbb14c3cea190015da19"},{"required":false,"desc":"","default":"","type":"string","name":"name","in":"body","_id":"56fa17c675bb290e001e68ba","ref":""},{"default":"","type":"string","name":"email","in":"body","_id":"56fa17c675bb290e001e68b9","ref":"","required":false,"desc":""},{"in":"body","_id":"56fa17c675bb290e001e68b8","ref":"","required":false,"desc":"used to turn off emails and reminders","default":"","type":"boolean","name":"active"},{"name":"activateReminder","in":"body","_id":"571e6dba92d3701900706eea","ref":"","required":false,"desc":"will have an email sent to remind the user to sign up","default":"","type":"boolean"}],"results":{"codes":[{"status":200,"language":"text","code":"{\n \"name\": \"Testing\" \n}"}]},"settings":"","url":"/organizations/:organization_id","auth":"required","examples":{"codes":[{"code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/users/2 -X PATCH -d \"name=Testing\"","language":"curl"}]},"method":"patch"},"editedParams2":true,"githubsync":"","hidden":false,"link_url":"","order":3,"title":"Modify a User","updates":[],"isReference":false,"link_external":false,"parentDoc":null,"sync_unique":"","version":"56fa046648e69f0e00a7742f","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
patchModify a User
Body Params
Only Staffjoy support may access this endpoint
{"_id":"571ea920ebc88a0e008d4ff1","api":{"examples":{"codes":[{"code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/users/2/sessions/","language":"curl"}]},"method":"get","params":[{"in":"path","_id":"56fbfb9e587e43170081eb61","ref":"","required":true,"desc":"ID of the user","default":"","type":"int","name":"user_id"}],"results":{"codes":[{"code":"{\n \"data\": [\n {\n \"last_used\": \"2016-04-22T06:24:14.800156\",\n \"key\": \"0a681a\",\n \"remote_ip\": \"24.23.242.250\"\n },\n ]\n}","name":"","status":200,"language":"json"}]},"settings":"","url":"/users/:user_id/sessions/","auth":"required"},"project":"56f9fe2cf9102d0e00ca623e","body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Self\"\n}\n[/block]","hidden":false,"link_external":false,"order":0,"slug":"all-sessions","type":"get","createdAt":"2016-04-25T23:32:48.433Z","editedParams2":true,"githubsync":"","parentDoc":null,"sync_unique":"","user":"561da5369ace800d00289ea3","version":"56fa046648e69f0e00a7742f","__v":1,"category":"571ea8fe4a14580e00760218","editedParams":true,"excerpt":"","isReference":false,"link_url":"","title":"All Sessions","updates":[],"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
getAll Sessions
Path Params
Permission Required: Self
{"_id":"571eaa1be2b7000e0091c3cf","api":{"method":"delete","params":[{"desc":"ID of the user","default":"","type":"int","name":"user_id","in":"path","_id":"56fbfb9e587e43170081eb61","ref":"","required":true}],"results":{"codes":[{"status":204,"language":"json","code":"{}","name":""}]},"settings":"","url":"/users/:user_id/sessions/","auth":"required","examples":{"codes":[{"language":"curl","code":"curl -u [[app:api-token]]: https://www.staffjoy.com/api/v2/users/2/sessions/ -X DELETE"}]}},"createdAt":"2016-04-25T23:36:59.113Z","editedParams":true,"order":1,"project":"56f9fe2cf9102d0e00ca623e","user":"561da5369ace800d00289ea3","__v":0,"category":"571ea8fe4a14580e00760218","editedParams2":true,"isReference":false,"parentDoc":null,"title":"Delete All Sessions","type":"delete","link_external":false,"slug":"all-sessions-1","updates":[],"version":"56fa046648e69f0e00a7742f","body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Self\"\n}\n[/block]\nThis will log you out too!","excerpt":"","githubsync":"","hidden":false,"link_url":"","sync_unique":"","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
deleteDelete All Sessions
Path Params
Permission Required: Self
This will log you out too!
Definition
Examples
curl -u [[app:api-token]]: https://www.staffjoy.com/api/v2/users/2/sessions/ -X DELETE
Result Format
{"_id":"571eabeb4a14580e00760223","isReference":false,"link_external":false,"link_url":"","type":"get","version":"56fa046648e69f0e00a7742f","hidden":false,"category":"571ea8fe4a14580e00760218","githubsync":"","user":"561da5369ace800d00289ea3","__v":1,"api":{"settings":"","url":"/users/:user_id/sessions/:session_id","auth":"required","examples":{"codes":[{"language":"curl","code":"curl -u [[app:api-token]]: https://www.staffjoy.com/api/v2/users/2/sessions/0a681a"}]},"method":"get","params":[{"_id":"56fbfb9e587e43170081eb61","ref":"","required":true,"desc":"ID of the user","default":"","type":"int","name":"user_id","in":"path"},{"in":"path","_id":"571eac36d8667f0e00a3c361","ref":"","required":true,"desc":"The key of the session","default":"","type":"string","name":"session_id"}],"results":{"codes":[{"status":200,"name":"","code":"{\n \"data\": {\n \"last_used\": \"2016-04-22T06:24:14.800156\",\n \"key\": \"0a681a\",\n \"remote_ip\": \"24.23.242.250\"\n }\n}","language":"json"}]}},"order":2,"project":"56f9fe2cf9102d0e00ca623e","sync_unique":"","body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Self\"\n}\n[/block]","editedParams2":true,"excerpt":"","parentDoc":null,"slug":"session","title":"Session","updates":[],"createdAt":"2016-04-25T23:44:43.039Z","editedParams":true,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
getSession
Path Params
Permission Required: Self
{"_id":"571eabf1d8667f0e00a3c360","parentDoc":null,"project":"56f9fe2cf9102d0e00ca623e","sync_unique":"","updates":[],"category":"571ea8fe4a14580e00760218","editedParams2":true,"githubsync":"","slug":"delete-a-session","body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Self\"\n}\n[/block]","excerpt":"","hidden":false,"isReference":false,"link_external":false,"order":3,"api":{"method":"delete","params":[{"default":"","type":"int","name":"user_id","in":"path","_id":"56fbfb9e587e43170081eb61","ref":"","required":true,"desc":"ID of the user"},{"_id":"571eac1d4a14580e00760225","default":"","desc":"The key of the session","name":"session_id","ref":"","required":true,"type":"string","in":"path"}],"results":{"codes":[{"status":204,"language":"json","code":"{}","name":""}]},"settings":"","url":"/users/:user_id/sessions/:session_id","auth":"required","examples":{"codes":[{"language":"curl","code":"curl -u [[app:api-token]]: https://www.staffjoy.com/api/v2/users/2/sessions/0a681a -X DELETE"}]}},"version":"56fa046648e69f0e00a7742f","title":"Delete a Session","user":"561da5369ace800d00289ea3","editedParams":true,"link_url":"","type":"delete","__v":1,"createdAt":"2016-04-25T23:44:49.178Z","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
deleteDelete a Session
Path Params
Permission Required: Self
Definition
Examples
curl -u [[app:api-token]]: https://www.staffjoy.com/api/v2/users/2/sessions/0a681a -X DELETE
Result Format
{"_id":"571ead31ac2a080e0014c4c5","editedParams":true,"link_external":false,"slug":"all-api-keys","sync_unique":"","version":"56fa046648e69f0e00a7742f","__v":0,"body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Self\"\n}\n[/block]","category":"571ea906d8667f0e00a3c356","hidden":false,"project":"56f9fe2cf9102d0e00ca623e","type":"get","editedParams2":true,"excerpt":"","githubsync":"","isReference":false,"parentDoc":null,"user":"561da5369ace800d00289ea3","link_url":"","order":0,"title":"All API Keys","updates":[],"api":{"url":"/users/:user_id/apikeys/","auth":"required","examples":{"codes":[{"language":"curl","code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/users/2/apikeys/"}]},"method":"get","params":[{"required":true,"desc":"ID of the user","default":"","type":"int","name":"user_id","in":"path","_id":"56fbfb9e587e43170081eb61","ref":""}],"results":{"codes":[{"status":200,"language":"json","code":"{\n \"data\": [\n {\n \"last_used\": \"2016-04-25T23:51:38\",\n \"created_at\": \"2016-04-20T19:23:56\",\n \"id\": 20,\n \"name\": \"example-key\"\n }\n ]\n}","name":""}]},"settings":""},"createdAt":"2016-04-25T23:50:09.005Z","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
getAll API Keys
Path Params
Permission Required: Self
{"_id":"571eadb9e2b7000e0091c3d5","api":{"params":[{"ref":"","required":true,"desc":"ID of the user","default":"","type":"int","name":"user_id","in":"path","_id":"56fbfb9e587e43170081eb61"},{"required":false,"desc":"A name for the key","default":"","type":"string","name":"name","in":"body","_id":"571eade9d8667f0e00a3c366","ref":""}],"results":{"codes":[{"status":201,"language":"json","code":"{\n \"key\": \"be-sure-to-save-your-key-you-will-never-be-able-to-read-it-again-also-know-that-this-is-an-example-and-not-a-valid-key\"\n}","name":""}]},"settings":"","url":"/users/:user_id/apikeys/","auth":"required","examples":{"codes":[{"code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/users/2/apikeys/ -X POST -d \"name=example\"","language":"curl"}]},"method":"post"},"hidden":false,"type":"post","user":"561da5369ace800d00289ea3","editedParams":true,"link_external":false,"link_url":"","parentDoc":null,"body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Self\"\n}\n[/block]","editedParams2":true,"githubsync":"","sync_unique":"","title":"Create an API Key","updates":[],"slug":"create-an-api-key","__v":1,"category":"571ea906d8667f0e00a3c356","createdAt":"2016-04-25T23:52:25.368Z","excerpt":"","isReference":false,"order":1,"project":"56f9fe2cf9102d0e00ca623e","version":"56fa046648e69f0e00a7742f","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
postCreate an API Key
Path Params
Body Params
Permission Required: Self
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/users/2/apikeys/ -X POST -d "name=example"
Result Format
{
"key": "be-sure-to-save-your-key-you-will-never-be-able-to-read-it-again-also-know-that-this-is-an-example-and-not-a-valid-key"
}
{"_id":"571ead43ebc88a0e008d4ff4","category":"571ea906d8667f0e00a3c356","createdAt":"2016-04-25T23:50:27.929Z","editedParams":true,"link_external":false,"parentDoc":null,"__v":0,"githubsync":"","isReference":false,"project":"56f9fe2cf9102d0e00ca623e","slug":"api-key","sync_unique":"","excerpt":"","order":2,"updates":[],"user":"561da5369ace800d00289ea3","type":"get","api":{"url":"/users/:user_id/apikeys/:key_id","auth":"required","examples":{"codes":[{"code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/users/2/apikeys/20","language":"curl"}]},"method":"get","params":[{"required":true,"desc":"ID of the user","default":"","type":"int","name":"user_id","in":"path","_id":"56fbfb9e587e43170081eb61","ref":""},{"ref":"","required":true,"type":"string","in":"path","_id":"571eac36d8667f0e00a3c361","default":"","desc":"The key of the session","name":"key_id"}],"results":{"codes":[{"name":"","code":"{\n \"data\": {\n \"last_used\": \"2016-04-25T23:56:39\",\n \"created_at\": \"2016-04-20T19:23:56\",\n \"id\": 20,\n \"name\": \"example-key\"\n }\n}","language":"json","status":200}]},"settings":""},"body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Self\"\n}\n[/block]","editedParams2":true,"hidden":false,"link_url":"","title":"API Key","version":"56fa046648e69f0e00a7742f","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
getAPI Key
Path Params
Permission Required: Self
{"_id":"571ead3b4a14580e00760227","__v":0,"parentDoc":null,"editedParams2":true,"excerpt":"","link_url":"","sync_unique":"","editedParams":true,"hidden":false,"isReference":false,"link_external":false,"project":"56f9fe2cf9102d0e00ca623e","slug":"delete-an-api-key","updates":[],"user":"561da5369ace800d00289ea3","api":{"method":"delete","params":[{"default":"","type":"int","name":"user_id","in":"path","_id":"56fbfb9e587e43170081eb61","ref":"","required":true,"desc":"ID of the user"},{"in":"path","_id":"571eac1d4a14580e00760225","default":"","desc":"The key of the session","name":"key_id","ref":"","required":true,"type":"string"}],"results":{"codes":[{"code":"{}","name":"","status":204,"language":"json"}]},"settings":"","url":"/users/:user_id/apikeys/:key_id","auth":"required","examples":{"codes":[{"code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/users/2/apikeys/20 -X DELETE","language":"curl"}]}},"body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Self\"\n}\n[/block]","category":"571ea906d8667f0e00a3c356","createdAt":"2016-04-25T23:50:19.825Z","githubsync":"","order":3,"title":"Delete an API Key","type":"delete","version":"56fa046648e69f0e00a7742f","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
deleteDelete an API Key
Path Params
Permission Required: Self
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/users/2/apikeys/20 -X DELETE
Result Format
{"_id":"56fa1407f9102d0e00ca6273","api":{"settings":"","url":"/organizations/","auth":"required","examples":{"codes":[{"language":"curl","code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/\n"}]},"method":"get","params":[{"required":false,"type":"int","in":"query","_id":"56fa13063130030e0081ba09","default":"0","desc":"Returns items (offset) to (offset + limit) - inclusive to exclusive - based on the sorted organization id.","name":"offset","ref":""},{"required":false,"desc":"Number of results to return","default":"25","type":"int","name":"limit","in":"query","_id":"56fa13063130030e0081ba08","ref":""}],"results":{"codes":[{"status":200,"language":"json","code":"{\n\tdata: [\n\t\t{\n\t\t\tworkers_can_claim_shifts_in_excess_of_max: false,\n\t\t\tpaid: true,\n\t\t\ttrial_days: 30,\n\t\t\tenable_time_off_requests_default: false,\n\t\t\tplan: \"per-seat-v1\",\n\t\t\tactive: true,\n\t\t\tearly_access: true,\n\t\t\tid: 1,\n\t\t\tshifts_assigned_days_before_start: 4,\n\t\t\tname: \"Staffjoy\",\n\t\t\tday_week_starts: \"monday\",\n\t\t\tcreated_at: \"2015-06-15T03:00:32\",\n\t\t\tpaid_until: \"2030-06-15T00:00:00\",\n\t\t\tenable_timeclock_default: true,\n\t\t\tenable_shiftplanning_export: false\n\t\t},\n {\n\t\t\tworkers_can_claim_shifts_in_excess_of_max: false,\n\t\t\tpaid: true,\n\t\t\ttrial_days: 30,\n\t\t\tenable_time_off_requests_default: false,\n\t\t\tplan: \"per-seat-v1\",\n\t\t\tactive: true,\n\t\t\tearly_access: true,\n\t\t\tid: 1,\n\t\t\tshifts_assigned_days_before_start: 4,\n\t\t\tname: \"Staffjoy Number 2\",\n\t\t\tday_week_starts: \"sunday\",\n\t\t\tcreated_at: \"2015-06-15T03:00:32\",\n\t\t\tpaid_until: \"2030-06-15T00:00:00\",\n\t\t\tenable_timeclock_default: true,\n\t\t\tenable_shiftplanning_export: false\n\t\t}\n ]\n}","name":""}]}},"category":"56fa141c75bb290e001e68b5","editedParams":true,"excerpt":"","isReference":false,"link_url":"","order":0,"title":"All Organizations","version":"56fa046648e69f0e00a7742f","type":"get","__v":0,"body":"[block:callout]\n{\n \"type\": \"warning\",\n \"title\": \"Only Staffjoy support may access this endpoint\",\n \"body\": \"For help in finding your organization's ID, please contact Staffjoy Support.\"\n}\n[/block]","editedParams2":true,"parentDoc":null,"project":"56f9fe2cf9102d0e00ca623e","sync_unique":"","user":"561aed1a30e7490d0022d6ae","createdAt":"2016-03-29T05:35:03.305Z","githubsync":"","hidden":false,"link_external":false,"slug":"get-all-organizations","updates":[],"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
getAll Organizations
Query Params
Only Staffjoy support may access this endpoint
For help in finding your organization's ID, please contact Staffjoy Support.
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/
Result Format
{
data: [
{
workers_can_claim_shifts_in_excess_of_max: false,
paid: true,
trial_days: 30,
enable_time_off_requests_default: false,
plan: "per-seat-v1",
active: true,
early_access: true,
id: 1,
shifts_assigned_days_before_start: 4,
name: "Staffjoy",
day_week_starts: "monday",
created_at: "2015-06-15T03:00:32",
paid_until: "2030-06-15T00:00:00",
enable_timeclock_default: true,
enable_shiftplanning_export: false
},
{
workers_can_claim_shifts_in_excess_of_max: false,
paid: true,
trial_days: 30,
enable_time_off_requests_default: false,
plan: "per-seat-v1",
active: true,
early_access: true,
id: 1,
shifts_assigned_days_before_start: 4,
name: "Staffjoy Number 2",
day_week_starts: "sunday",
created_at: "2015-06-15T03:00:32",
paid_until: "2030-06-15T00:00:00",
enable_timeclock_default: true,
enable_shiftplanning_export: false
}
]
}
{"_id":"56fa0d4f75bb290e001e68af","githubsync":"","sync_unique":"","title":"Create Organization","__v":2,"api":{"params":[{"ref":"","required":true,"desc":"Name the organization. Your workers will see this.","default":"","type":"string","name":"name","in":"body","_id":"56fa17c675bb290e001e68ba"},{"type":"string","name":"day_week_starts","in":"body","_id":"56fa17c675bb290e001e68b9","ref":"","required":false,"desc":"Pick the day of the week when your scheduling begins. This is universal for an organization and cannot be modified. The parameter is the lowercase name of the day.","default":"monday"},{"required":false,"desc":"Plan that the organization uses.","default":"flex-v1","type":"string","name":"plan","in":"body","_id":"56fa17c675bb290e001e68b8","ref":""},{"desc":"Number of free trial days that a new organization receives","default":"14","type":"int","name":"trial_days","in":"body","_id":"56fa17c675bb290e001e68b7","ref":"","required":false}],"results":{"codes":[{"status":201,"language":"json","code":"{\n \"workers_can_claim_shifts_in_excess_of_max\": false,\n \"paid\": false,\n \"trial_days\": 14,\n \"enable_time_off_requests_default\": false,\n \"plan\": \"per-seat-v1\",\n \"active\": false,\n \"early_access\": false,\n \"id\": 344,\n \"shifts_assigned_days_before_start\": 4,\n \"name\": \"Staffjoy\",\n \"day_week_starts\": \"monday\",\n \"created_at\": \"2016-03-29T05:52:35\",\n \"paid_until\": null,\n \"enable_timeclock_default\": false,\n \"enable_shiftplanning_export\": false\n}","name":""}]},"settings":"","url":"/organizations/","auth":"required","examples":{"codes":[{"code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/ -X POST -d \"name=Staffjoy\"","language":"curl"}]},"method":"post"},"order":1,"parentDoc":null,"user":"561aed1a30e7490d0022d6ae","body":"[block:callout]\n{\n \"type\": \"warning\",\n \"title\": \"Only Staffjoy support may access this endpoint\",\n \"body\": \"To create a new account, for testing or other purposes, please contact Staffjoy support.\"\n}\n[/block]","category":"56fa141c75bb290e001e68b5","link_url":"","project":"56f9fe2cf9102d0e00ca623e","slug":"organizations","type":"post","editedParams2":true,"excerpt":"","link_external":false,"isReference":false,"updates":[],"version":"56fa046648e69f0e00a7742f","createdAt":"2016-03-29T05:06:23.181Z","editedParams":true,"hidden":false,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
postCreate Organization
Body Params
Only Staffjoy support may access this endpoint
To create a new account, for testing or other purposes, please contact Staffjoy support.
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/ -X POST -d "name=Staffjoy"
Result Format
{
"workers_can_claim_shifts_in_excess_of_max": false,
"paid": false,
"trial_days": 14,
"enable_time_off_requests_default": false,
"plan": "per-seat-v1",
"active": false,
"early_access": false,
"id": 344,
"shifts_assigned_days_before_start": 4,
"name": "Staffjoy",
"day_week_starts": "monday",
"created_at": "2016-03-29T05:52:35",
"paid_until": null,
"enable_timeclock_default": false,
"enable_shiftplanning_export": false
}
{"_id":"56fbfa184c3cea190015da12","link_url":"","version":"56fa046648e69f0e00a7742f","createdAt":"2016-03-30T16:08:56.055Z","excerpt":"","isReference":false,"hidden":false,"order":2,"slug":"get-an-organization","title":"Organization","body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Organization Member\"\n}\n[/block]","editedParams":true,"githubsync":"","category":"56fa141c75bb290e001e68b5","link_external":false,"project":"56f9fe2cf9102d0e00ca623e","editedParams2":true,"parentDoc":null,"sync_unique":"","type":"get","updates":[],"__v":2,"api":{"auth":"required","examples":{"codes":[{"code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1","language":"curl"}]},"method":"get","params":[{"_id":"56fbfb9e587e43170081eb61","default":"","desc":"ID of the organization","name":"organization_id","ref":"","required":true,"type":"int","in":"path"}],"results":{"codes":[{"status":200,"language":"json","code":"{\n \"data\": {\n \"workers_can_claim_shifts_in_excess_of_max\": false,\n \"paid\": true,\n \"trial_days\": 30,\n \"enable_time_off_requests_default\": false,\n \"plan\": \"per-seat-v1\",\n \"active\": true,\n \"early_access\": true,\n \"id\": 1,\n \"shifts_assigned_days_before_start\": 4,\n \"name\": \"Staffjoy\",\n \"day_week_starts\": \"monday\",\n \"created_at\": \"2015-06-15T03:00:32\",\n \"paid_until\": \"2030-06-15T00:00:00\",\n \"enable_timeclock_default\": true,\n \"enable_shiftplanning_export\": false\n },\n \"resources\": [\n \"admins\",\n \"locations\",\n \"workers\"\n ]\n}","name":""}]},"settings":"","url":"/organizations/:organization_id"},"user":"561aed1a30e7490d0022d6ae","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
getOrganization
Path Params
Permission Required: Organization Member
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1
Result Format
{
"data": {
"workers_can_claim_shifts_in_excess_of_max": false,
"paid": true,
"trial_days": 30,
"enable_time_off_requests_default": false,
"plan": "per-seat-v1",
"active": true,
"early_access": true,
"id": 1,
"shifts_assigned_days_before_start": 4,
"name": "Staffjoy",
"day_week_starts": "monday",
"created_at": "2015-06-15T03:00:32",
"paid_until": "2030-06-15T00:00:00",
"enable_timeclock_default": true,
"enable_shiftplanning_export": false
},
"resources": [
"admins",
"locations",
"workers"
]
}
{"_id":"56fbf5a5587e43170081eb4f","order":3,"slug":"modify-an-organization-1","updates":[],"user":"561aed1a30e7490d0022d6ae","__v":2,"api":{"auth":"required","examples":{"codes":[{"code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/ -X PATCH -d \"name=Staffjoy\"","language":"curl"}]},"method":"patch","params":[{"in":"path","_id":"56fbfbb14c3cea190015da19","ref":"","required":true,"desc":"ID of the organization","default":"","type":"string","name":"organization_id"},{"ref":"","required":false,"desc":"Name the organization. Workers see this.","default":"","type":"string","name":"name","in":"body","_id":"56fa17c675bb290e001e68ba"},{"required":false,"desc":"Global \"enable\" of communication, scheduling, and more.","default":"","type":"boolean","name":"active","in":"body","_id":"56fa17c675bb290e001e68b9","ref":""},{"default":"","type":"int","name":"shifts_assigned_days_before_start","in":"body","_id":"56fa17c675bb290e001e68b8","ref":"","required":false,"desc":"(Boss plan only) How many days prior to the start of a week that the system automatically computes schedules"},{"_id":"56fa17c675bb290e001e68b7","ref":"","required":false,"desc":"Whether newly-created roles have the Timeclock feature enabled.","default":"","type":"boolean","name":"enable_timeclock_default","in":"body"},{"_id":"56fbf78c0256470e0052539c","ref":"","required":false,"desc":"Whether newly-created roles have the Time Off Requests feature enabled.","default":"","type":"boolean","name":"enable_time_off_requests_default","in":"body"},{"_id":"56fbf78c0256470e0052539b","ref":"","required":false,"desc":"(Boss plan only) Whether workers are allowed to claim extra shifts in excess of their compliance rules.","default":"","type":"boolean","name":"workers_can_claim_shifts_in_excess_of_max","in":"body"}],"results":{"codes":[{"language":"json","code":"{\n \"name\": \"Staffjoy\"\n}","name":"","status":200}]},"settings":"","url":"/organizations/:organization_id"},"editedParams":true,"project":"56f9fe2cf9102d0e00ca623e","title":"Modify an Organization","version":"56fa046648e69f0e00a7742f","excerpt":"","isReference":false,"parentDoc":null,"editedParams2":true,"hidden":false,"link_external":false,"sync_unique":"","type":"patch","body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Organization Admin\"\n}\n[/block]","createdAt":"2016-03-30T15:49:57.195Z","category":"56fa141c75bb290e001e68b5","githubsync":"","link_url":"","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
patchModify an Organization
Path Params
Body Params
Permission Required: Organization Admin
{"_id":"571a9312ee0bfe1700373424","sync_unique":"","type":"get","updates":[],"editedParams":true,"excerpt":"","githubsync":"","slug":"all-organization-admins","hidden":false,"link_url":"","project":"56f9fe2cf9102d0e00ca623e","title":"All Organization Admins","__v":1,"api":{"examples":{"codes":[{"language":"curl","code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/admins/"}]},"method":"get","params":[{"in":"path","_id":"5717c29cab848c19009d10eb","ref":"","required":true,"desc":"ID of the organization","default":"","type":"int","name":"organization_id"}],"results":{"codes":[{"name":"","status":200,"language":"json","code":"{\n \"data\": [\n {\n \"username\": \"tesla\",\n \"confirmed\": true,\n \"name\": \"Nikola Tesla\",\n \"active\": true,\n \"member_since\": \"2015-02-14T20:53:31\",\n \"last_seen\": \"2016-04-22T21:17:54\",\n \"sudo\": true,\n \"email\": \"[email protected]\",\n \"id\": 1\n },\n {\n \"username\": \"rosalind\",\n \"confirmed\": true,\n \"name\": \"Rosalind Franklin\",\n \"active\": true,\n \"member_since\": \"2015-02-14T20:53:31\",\n \"last_seen\": \"2016-04-22T21:19:28.849251\",\n \"sudo\": true,\n \"email\": \"[email protected]\",\n \"id\": 2\n },\n ]\n}"}]},"settings":"","url":"/organizations/:organization_id/admins/","auth":"required"},"body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Organization Admin\"\n}\n[/block]","category":"571a92fcd2ed1c17005a7955","createdAt":"2016-04-22T21:09:38.399Z","version":"56fa046648e69f0e00a7742f","parentDoc":null,"user":"561da5369ace800d00289ea3","editedParams2":true,"isReference":false,"link_external":false,"order":0,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
getAll Organization Admins
Path Params
Permission Required: Organization Admin
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/admins/
Result Format
{
"data": [
{
"username": "tesla",
"confirmed": true,
"name": "Nikola Tesla",
"active": true,
"member_since": "2015-02-14T20:53:31",
"last_seen": "2016-04-22T21:17:54",
"sudo": true,
"email": "[email protected]",
"id": 1
},
{
"username": "rosalind",
"confirmed": true,
"name": "Rosalind Franklin",
"active": true,
"member_since": "2015-02-14T20:53:31",
"last_seen": "2016-04-22T21:19:28.849251",
"sudo": true,
"email": "[email protected]",
"id": 2
},
]
}
{"_id":"571a95daf504f81700e41f2d","createdAt":"2016-04-22T21:21:30.735Z","editedParams2":true,"hidden":false,"isReference":false,"link_url":"","type":"post","user":"561da5369ace800d00289ea3","category":"571a92fcd2ed1c17005a7955","api":{"method":"post","params":[{"desc":"ID of the organization","default":"","type":"int","name":"organization_id","in":"path","_id":"57166b4cb5af590e00a0ffc7","ref":"","required":true},{"name":"id","in":"body","_id":"571a960aee0bfe170037342a","ref":"","required":false,"desc":"If known, a User ID is the best way to add a user as an admin","default":"","type":"string"},{"default":"","type":"string","name":"email","in":"body","_id":"571a960dd2ed1c17005a7962","ref":"","required":false,"desc":"f the User ID is not known, a user can be added as an admin via their email address. Use the email address if the worker does not currently have a Staffjoy account."},{"in":"body","_id":"57166b4cb5af590e00a0ffc6","ref":"","required":false,"desc":"the user is being invited to sign up for Staffjoy, a name can optionally be given to the worker","default":"","type":"string","name":"name"}],"results":{"codes":[{"status":201,"language":"json","code":"{\n \"username\": null,\n \"confirmed\": true,\n \"name\": \"Leonhard Euler\",\n \"active\": true,\n \"member_since\": \"2015-11-08T23:05:26\",\n \"last_seen\": \"2016-04-22T21:26:44\",\n \"sudo\": false,\n \"email\": \"[email protected]\",\n \"id\": 421\n}","name":""}]},"settings":"","url":"/organizations/:organization_id/admins/","auth":"required","examples":{"codes":[{"language":"curl","code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/admins/ -X POST -d \"[email protected]\""}]}},"slug":"create-organization-admin","__v":3,"updates":[],"version":"56fa046648e69f0e00a7742f","link_external":false,"body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Organization Admin\"\n}\n[/block]","editedParams":true,"excerpt":"","githubsync":"","order":1,"parentDoc":null,"project":"56f9fe2cf9102d0e00ca623e","title":"Create Organization Admin","sync_unique":"","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
postCreate Organization Admin
Path Params
Body Params
Permission Required: Organization Admin
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/admins/ -X POST -d "[email protected]"
Result Format
{
"username": null,
"confirmed": true,
"name": "Leonhard Euler",
"active": true,
"member_since": "2015-11-08T23:05:26",
"last_seen": "2016-04-22T21:26:44",
"sudo": false,
"email": "[email protected]",
"id": 421
}
{"_id":"571a97c4f504f81700e41f31","link_url":"","updates":[],"body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Organization Admin\"\n}\n[/block]","editedParams":true,"parentDoc":null,"slug":"admin","user":"561da5369ace800d00289ea3","api":{"url":"/organizations/:organization_id/admins/:user_id","auth":"required","examples":{"codes":[{"code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/admins/2","language":"curl"}]},"method":"get","params":[{"type":"int","name":"organization_id","in":"path","_id":"57167483b5af590e00a0fff0","ref":"","required":true,"desc":"ID of the organization","default":""},{"type":"int","name":"user_id","in":"path","_id":"57167483b5af590e00a0ffef","ref":"","required":true,"desc":"ID of the user","default":""}],"results":{"codes":[{"status":200,"language":"json","code":"{\n \"data\": {\n \"username\": \"rosalind\",\n \"confirmed\": true,\n \"name\": \"Rosalind Franklin\",\n \"active\": true,\n \"member_since\": \"2015-02-14T20:53:31\",\n \"last_seen\": \"2016-04-22T21:35:43.355940\",\n \"sudo\": true,\n \"email\": \"[email protected]\",\n \"id\": 2\n },\n \"resources\": []\n}","name":""}]},"settings":""},"excerpt":"","githubsync":"","hidden":false,"order":2,"project":"56f9fe2cf9102d0e00ca623e","sync_unique":"","title":"Admin","__v":1,"category":"571a92fcd2ed1c17005a7955","createdAt":"2016-04-22T21:29:40.881Z","editedParams2":true,"isReference":false,"link_external":false,"type":"get","version":"56fa046648e69f0e00a7742f","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
getAdmin
Path Params
Permission Required: Organization Admin
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/admins/2
Result Format
{
"data": {
"username": "rosalind",
"confirmed": true,
"name": "Rosalind Franklin",
"active": true,
"member_since": "2015-02-14T20:53:31",
"last_seen": "2016-04-22T21:35:43.355940",
"sudo": true,
"email": "[email protected]",
"id": 2
},
"resources": []
}
{"_id":"57279fac0fe9c40e005ba8ea","githubsync":"","hidden":false,"parentDoc":null,"type":"patch","user":"561da5369ace800d00289ea3","editedParams":true,"editedParams2":true,"link_external":false,"order":3,"slug":"modify-an-admin","body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Organization Admin\"\n}\n[/block]","link_url":"","sync_unique":"","version":"56fa046648e69f0e00a7742f","excerpt":"","isReference":false,"project":"56f9fe2cf9102d0e00ca623e","__v":0,"api":{"examples":{"codes":[{"language":"curl","code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/admins/2 -X PATCH -d \"activateReminder=true\""}]},"method":"patch","params":[{"in":"path","_id":"57167483b5af590e00a0fff0","ref":"","required":true,"desc":"ID of the organization","default":"","type":"int","name":"organization_id"},{"ref":"","required":true,"desc":"ID of the user","default":"","type":"int","name":"user_id","in":"path","_id":"57167483b5af590e00a0ffef"},{"required":false,"desc":"an email will be sent to remind the user to sign up for Staffjoy","default":"","type":"boolean","name":"activateReminder","in":"body","_id":"57279fac0fe9c40e005ba8eb","ref":""}],"results":{"codes":[{"status":204,"language":"json","code":"{}","name":""}]},"settings":"","url":"/organizations/:organization_id/admins/:user_id","auth":"required"},"category":"571a92fcd2ed1c17005a7955","createdAt":"2016-05-02T18:42:52.499Z","title":"Modify an Admin","updates":[],"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
patchModify an Admin
Path Params
Body Params
Permission Required: Organization Admin
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/admins/2 -X PATCH -d "activateReminder=true"
Result Format
{"_id":"571a97dfeeb4160e002ce9d3","createdAt":"2016-04-22T21:30:07.940Z","editedParams":true,"excerpt":"","link_url":"","project":"56f9fe2cf9102d0e00ca623e","version":"56fa046648e69f0e00a7742f","api":{"examples":{"codes":[{"language":"curl","code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/admins/2 -X DELETE"}]},"method":"delete","params":[{"_id":"57167815810df00e00cc7aae","ref":"","required":true,"desc":"ID of the organization","default":"","type":"int","name":"organization_id","in":"path"},{"_id":"57167815810df00e00cc7aad","default":"","desc":"ID of the user being removed from admin permissions","name":"user_id","ref":"","required":true,"type":"boolean","in":"path"}],"results":{"codes":[{"status":204,"language":"json","code":"{}","name":""}]},"settings":"","url":"/organizations/:organization_id/admins/:user_id","auth":"required"},"body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Organization Admin\"\n}\n[/block]","type":"delete","__v":0,"hidden":false,"isReference":false,"link_external":false,"order":4,"slug":"delete-an-admin","title":"Delete an Admin","updates":[],"user":"561da5369ace800d00289ea3","editedParams2":true,"githubsync":"","parentDoc":null,"sync_unique":"","category":"571a92fcd2ed1c17005a7955","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
deleteDelete an Admin
Path Params
Permission Required: Organization Admin
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/admins/2 -X DELETE
Result Format
{"_id":"5717c29cab848c19009d10e8","editedParams2":true,"link_external":false,"slug":"all-organization-workers","user":"561da5369ace800d00289ea3","__v":4,"editedParams":true,"type":"get","api":{"auth":"required","examples":{"codes":[{"code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/workers/","language":"curl"}]},"method":"get","params":[{"ref":"","required":true,"desc":"ID of the organization","default":"","type":"int","name":"organization_id","in":"path","_id":"5717c29cab848c19009d10eb"},{"required":false,"desc":"filter results by workers that have been archived or not","default":"","type":"boolean","name":"archived","in":"query","_id":"571a9464f504f81700e41f27","ref":""},{"default":"","type":"string","name":"filter_by_email","in":"query","_id":"571a9464f504f81700e41f26","ref":"","required":false,"desc":"filter results by the given email address"},{"_id":"571a9464f504f81700e41f24","ref":"","required":false,"desc":"filter results by the given location ID","default":"","type":"int","name":"filter_by_location_id","in":"query"},{"_id":"571a9464f504f81700e41f25","ref":"","required":false,"desc":"filter results by the given role ID","default":"","type":"int","name":"filter_by_role_id","in":"query"}],"results":{"codes":[{"status":200,"language":"json","code":"{\n \"data\": [\n {\n \"archived\": false,\n \"role_name\": \"Hackers\",\n \"location_name\": \"San Francisco\",\n \"name\": \"Leonhard Euler\",\n \"user_id\": 1,\n \"location_id\": 6,\n \"email\": \"[email protected]\",\n \"role_id\": 656\n },\n {\n \"archived\": false,\n \"role_name\": \"Hackers\",\n \"location_name\": \"San Francisco\",\n \"name\": \"Rosalind Franklin\",\n \"user_id\": 2,\n \"location_id\": 6,\n \"email\": \"[email protected]\",\n \"role_id\": 656\n },\n {\n \"archived\": false,\n \"role_name\": \"Hackers\",\n \"location_name\": \"San Francisco\",\n \"name\": \"Nikola Tesla\",\n \"user_id\": 706,\n \"location_id\": 6,\n \"email\": \"[email protected]\",\n \"role_id\": 656\n },\n {\n \"archived\": true,\n \"role_name\": \"Hackers\",\n \"location_name\": \"San Francisco\",\n \"name\": \"George Dantzig\",\n \"user_id\": 95,\n \"location_id\": 6,\n \"email\": \"[email protected]\",\n \"role_id\": 656\n },\n ]\n}","name":""}]},"settings":"","url":"/organizations/:organization_id/workers/"},"createdAt":"2016-04-20T17:55:40.622Z","hidden":false,"link_url":"","sync_unique":"","updates":[],"body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Organization Member\"\n}\n[/block]\nThe response contains the essential information to access the main endpoint for a worker in the organization hierarchy.","excerpt":"Makes it easy to access all workers in an organization and to find a worker's location within the organization hierarchy.","githubsync":"","isReference":false,"order":0,"parentDoc":null,"project":"56f9fe2cf9102d0e00ca623e","title":"All Organization Workers","category":"5717c1aa9c10132400d0ba6c","version":"56fa046648e69f0e00a7742f","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
getAll Organization Workers
Path Params
Query Params
Permission Required: Organization Member
The response contains the essential information to access the main endpoint for a worker in the organization hierarchy.
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/workers/
Result Format
{
"data": [
{
"archived": false,
"role_name": "Hackers",
"location_name": "San Francisco",
"name": "Leonhard Euler",
"user_id": 1,
"location_id": 6,
"email": "[email protected]",
"role_id": 656
},
{
"archived": false,
"role_name": "Hackers",
"location_name": "San Francisco",
"name": "Rosalind Franklin",
"user_id": 2,
"location_id": 6,
"email": "[email protected]",
"role_id": 656
},
{
"archived": false,
"role_name": "Hackers",
"location_name": "San Francisco",
"name": "Nikola Tesla",
"user_id": 706,
"location_id": 6,
"email": "[email protected]",
"role_id": 656
},
{
"archived": true,
"role_name": "Hackers",
"location_name": "San Francisco",
"name": "George Dantzig",
"user_id": 95,
"location_id": 6,
"email": "[email protected]",
"role_id": 656
},
]
}
{"_id":"5716635a5d90dc170060ef2f","__v":3,"excerpt":"","githubsync":"","hidden":false,"link_url":"","title":"All Locations","user":"561da5369ace800d00289ea3","version":"56fa046648e69f0e00a7742f","link_external":false,"order":0,"parentDoc":null,"slug":"locations","updates":[],"api":{"settings":"","url":"/organizations/:organization_id/locations/","auth":"required","examples":{"codes":[{"language":"curl","code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/"}]},"method":"get","params":[{"name":"organization_id","in":"path","_id":"5716638f3389e81900a488ed","ref":"","required":true,"desc":"ID of the organization","default":"","type":"int"},{"ref":"","required":false,"type":"boolean","in":"query","_id":"57166508893cbe0e002d7675","default":"","desc":"If true, all corresponding roles will be returned with each result","name":"recurse"},{"in":"query","_id":"57166508893cbe0e002d7674","default":"","desc":"filter results by the archived flag. Use false to return only current locations","name":"archived","ref":"","required":false,"type":"boolean"}],"results":{"codes":[{"name":"","code":"{\n \"data\": [\n {\n \"organization_id\": 1,\n \"timezone\": \"America/Los_Angeles\",\n \"archived\": false,\n \"id\": 6,\n \"name\": \"San Francisco\"\n },\n {\n \"organization_id\": 1,\n \"timezone\": \"America/Los_Angeles\",\n \"archived\": true,\n \"id\": 425,\n \"name\": \"A Deleted Location\"\n },\n {\n \"organization_id\": 1,\n \"timezone\": \"America/Los_Angeles\",\n \"archived\": false,\n \"id\": 542,\n \"name\": \"Portland\"\n }\n ]\n}","language":"json","status":200}]}},"category":"56fbf8940256470e005253a0","createdAt":"2016-04-19T16:56:58.303Z","editedParams2":true,"isReference":false,"sync_unique":"","type":"get","body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Organization Member\"\n}\n[/block]","editedParams":true,"project":"56f9fe2cf9102d0e00ca623e","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
getAll Locations
Path Params
Query Params
Permission Required: Organization Member
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/
Result Format
{
"data": [
{
"organization_id": 1,
"timezone": "America/Los_Angeles",
"archived": false,
"id": 6,
"name": "San Francisco"
},
{
"organization_id": 1,
"timezone": "America/Los_Angeles",
"archived": true,
"id": 425,
"name": "A Deleted Location"
},
{
"organization_id": 1,
"timezone": "America/Los_Angeles",
"archived": false,
"id": 542,
"name": "Portland"
}
]
}
{"_id":"57166a9540ef9c2000caca0d","editedParams":true,"hidden":false,"isReference":false,"link_url":"","user":"561da5369ace800d00289ea3","body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Organization Admin\"\n}\n[/block]","createdAt":"2016-04-19T17:27:49.860Z","link_external":false,"project":"56f9fe2cf9102d0e00ca623e","title":"Create Location","updates":[],"api":{"auth":"required","examples":{"codes":[{"language":"curl","code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/ -X POST -d \"name=Oakland\" -d \"timezone=America/Los_Angeles\""}]},"method":"post","params":[{"desc":"ID of the organization","default":"","type":"int","name":"organization_id","in":"path","_id":"57166b4cb5af590e00a0ffc7","ref":"","required":true},{"ref":"","required":false,"desc":"The name of the location","default":"","type":"string","name":"name","in":"body","_id":"57166b4cb5af590e00a0ffc6"},{"type":"string","name":"timezone","in":"body","_id":"57166b4cb5af590e00a0ffc5","ref":"","required":false,"desc":"The timezone that this location is situated in, will be UTC by default","default":""}],"results":{"codes":[{"language":"json","status":201,"name":"","code":"{\n \"organization_id\": 1,\n \"timezone\": \"America/Los_Angeles\",\n \"archived\": false,\n \"id\": 556,\n \"name\": \"Oakland\"\n}"}]},"settings":"","url":"/organizations/:organization_id/locations/"},"category":"56fbf8940256470e005253a0","order":1,"parentDoc":null,"slug":"create-location","version":"56fa046648e69f0e00a7742f","__v":1,"editedParams2":true,"excerpt":"","githubsync":"","sync_unique":"","type":"post","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
postCreate Location
Path Params
Body Params
Permission Required: Organization Admin
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/ -X POST -d "name=Oakland" -d "timezone=America/Los_Angeles"
Result Format
{
"organization_id": 1,
"timezone": "America/Los_Angeles",
"archived": false,
"id": 556,
"name": "Oakland"
}
{"_id":"5716739b810df00e00cc7a95","parentDoc":null,"project":"56f9fe2cf9102d0e00ca623e","title":"Location","body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Organization Member\"\n}\n[/block]","category":"56fbf8940256470e005253a0","link_external":false,"link_url":"","order":2,"type":"get","createdAt":"2016-04-19T18:06:19.498Z","editedParams":true,"editedParams2":true,"isReference":false,"sync_unique":"","user":"561da5369ace800d00289ea3","version":"56fa046648e69f0e00a7742f","__v":1,"api":{"results":{"codes":[{"status":200,"language":"json","code":"{\n \"data\": {\n \"organization_id\": 1,\n \"timezone\": \"America/Los_Angeles\",\n \"archived\": false,\n \"id\": 6,\n \"name\": \"San Francisco\"\n },\n \"resources\": [\n \"roles\",\n \"attendance\"\n ]\n}","name":""}]},"settings":"","url":"/organizations/:organization_id/locations/:location_id","auth":"required","examples":{"codes":[{"language":"curl","code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6"}]},"method":"get","params":[{"_id":"57167483b5af590e00a0fff0","default":"","desc":"ID of the organization","name":"organization_id","ref":"","required":true,"type":"int","in":"path"},{"_id":"57167483b5af590e00a0ffef","default":"","desc":"ID of the location","name":"location_id","ref":"","required":true,"type":"int","in":"path"},{"_id":"57167483b5af590e00a0ffee","default":"","desc":"If true, all corresponding roles will be returned with the response.","name":"recurse","ref":"","required":false,"type":"boolean","in":"query"},{"in":"query","_id":"57167483b5af590e00a0ffed","default":"","desc":"If recurse is set to true, this parameter will filter roles by their archived property. Use false to return only active roles.","name":"archived","ref":"","required":false,"type":"boolean"}]},"githubsync":"","hidden":false,"slug":"location","excerpt":"","updates":[],"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
getLocation
Path Params
Query Params
Permission Required: Organization Member
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6
Result Format
{
"data": {
"organization_id": 1,
"timezone": "America/Los_Angeles",
"archived": false,
"id": 6,
"name": "San Francisco"
},
"resources": [
"roles",
"attendance"
]
}
{"_id":"571673a43389e81900a48937","createdAt":"2016-04-19T18:06:28.525Z","editedParams2":true,"user":"561da5369ace800d00289ea3","version":"56fa046648e69f0e00a7742f","slug":"modify-a-location","__v":2,"category":"56fbf8940256470e005253a0","editedParams":true,"excerpt":"","hidden":false,"link_external":false,"parentDoc":null,"title":"Modify a Location","updates":[],"api":{"params":[{"ref":"","required":true,"desc":"ID of the organization","default":"","type":"int","name":"organization_id","in":"path","_id":"5716790c893cbe0e002d76d0"},{"type":"int","name":"location_id","in":"path","_id":"5716790c893cbe0e002d76cf","ref":"","required":true,"desc":"ID of the location","default":""},{"type":"string","name":"name","in":"body","_id":"5716790c893cbe0e002d76ce","ref":"","required":false,"desc":"The name of the location","default":""},{"required":false,"type":"boolean","in":"body","_id":"5716790c893cbe0e002d76cd","default":"","desc":"Toggle the archived state of the location","name":"archived","ref":""}],"results":{"codes":[{"name":"","code":"{\n \"name\": \"San Mateo\"\n}","language":"json","status":200}]},"settings":"","url":"/organizations/:organization_id/locations/:location_id","auth":"required","examples":{"codes":[{"language":"curl","code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6 -X PATCH -d \"name=San Mateo\""}]},"method":"patch"},"githubsync":"","isReference":false,"project":"56f9fe2cf9102d0e00ca623e","body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Organization Admin\",\n \"body\": \"However only Staffjoy support can use the archived parameter.\"\n}\n[/block]","link_url":"","order":3,"sync_unique":"","type":"patch","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
patchModify a Location
Path Params
Body Params
Permission Required: Organization Admin
However only Staffjoy support can use the archived parameter.
{"_id":"571673b85d90dc170060ef6f","createdAt":"2016-04-19T18:06:48.893Z","excerpt":"","link_external":false,"parentDoc":null,"api":{"settings":"","url":"/organizations/:organization_id/locations/:location_id","auth":"required","examples":{"codes":[{"language":"curl","code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6 -X DELETE"}]},"method":"delete","params":[{"_id":"57167815810df00e00cc7aae","ref":"","required":true,"desc":"ID of the organization","default":"","type":"int","name":"organization_id","in":"path"},{"_id":"57167815810df00e00cc7aad","ref":"","required":true,"desc":"ID of the location","default":"","type":"boolean","name":"location_id","in":"path"}],"results":{"codes":[{"status":204,"language":"json","code":"{}","name":""}]}},"editedParams":true,"githubsync":"","sync_unique":"","user":"561da5369ace800d00289ea3","version":"56fa046648e69f0e00a7742f","body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Organization Admin\"\n}\n[/block]","order":4,"type":"delete","project":"56f9fe2cf9102d0e00ca623e","slug":"delete-location","__v":1,"category":"56fbf8940256470e005253a0","editedParams2":true,"hidden":false,"isReference":false,"link_url":"","title":"Delete Location","updates":[],"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
deleteDelete Location
Path Params
Permission Required: Organization Admin
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6 -X DELETE
Result Format
{"_id":"573bb26674d9f20e00c14f25","createdAt":"2016-05-18T00:08:06.994Z","editedParams2":true,"githubsync":"","project":"56f9fe2cf9102d0e00ca623e","type":"get","updates":[],"__v":1,"isReference":false,"order":0,"slug":"location-shifts","sync_unique":"","excerpt":"","body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Location Manager\",\n \"body\": \"Managers are limited to their location. Organization administrators have access in all locations.\"\n}\n[/block]","hidden":false,"link_external":false,"parentDoc":null,"title":"Location Shifts","user":"561da5369ace800d00289ea3","version":"56fa046648e69f0e00a7742f","api":{"settings":"","url":"/organizations/:organization_id/locations/:location_id/shifts/","auth":"required","examples":{"codes":[{"language":"curl","code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/shifts/?start=2016-05-22&end=2016-05-25"}]},"method":"get","params":[{"default":"","type":"int","name":"organization_id","in":"path","_id":"5717c29cab848c19009d10eb","ref":"","required":true,"desc":"ID of the organization"},{"in":"path","_id":"5727a1af51a8c90e00bdb584","ref":"","required":true,"desc":"ID of the location","default":"","type":"int","name":"location_id"},{"type":"string","in":"query","_id":"573bb30cf09c292200b39736","default":"","desc":"Searches for shifts that start after this time (Iso8601 datetime)","name":"start","ref":"","required":false},{"default":"","type":"string","name":"end","in":"query","_id":"573bb30cf09c292200b39735","ref":"","required":false,"desc":"Searches for shifts that start before this time (Iso8601 datetime)"},{"in":"query","_id":"573bb30cf09c292200b39734","default":"","desc":"If true, will return all assigned shifts that are current","name":"active","ref":"","required":false,"type":"boolean"}],"results":{"codes":[{"code":"{\n \"data\": [\n {\n \"user_id\": 1,\n \"stop\": \"2016-05-24T00:00:00\",\n \"role_id\": 656,\n \"start\": \"2016-05-23T16:00:00\",\n \"published\": false,\n \"user_name\": \"Leonhard Euler\",\n \"id\": 42376\n },\n {\n \"user_id\": 1,\n \"stop\": \"2016-05-25T00:00:00\",\n \"role_id\": 656,\n \"start\": \"2016-05-24T16:00:00\",\n \"published\": false,\n \"user_name\": \"Rosalind Franklin\",\n \"id\": 42377\n },\n ]\n}","name":"","status":200,"language":"json"}]}},"category":"573bb2522cf9af3200d588b3","editedParams":true,"link_url":"","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
getLocation Shifts
Path Params
Query Params
Permission Required: Location Manager
Managers are limited to their location. Organization administrators have access in all locations.
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/shifts/?start=2016-05-22&end=2016-05-25
Result Format
{
"data": [
{
"user_id": 1,
"stop": "2016-05-24T00:00:00",
"role_id": 656,
"start": "2016-05-23T16:00:00",
"published": false,
"user_name": "Leonhard Euler",
"id": 42376
},
{
"user_id": 1,
"stop": "2016-05-25T00:00:00",
"role_id": 656,
"start": "2016-05-24T16:00:00",
"published": false,
"user_name": "Rosalind Franklin",
"id": 42377
},
]
}
{"_id":"573bb32eee2b3b2200422953","order":1,"parentDoc":null,"project":"56f9fe2cf9102d0e00ca623e","slug":"location-timeclocks","title":"Location Timeclocks","githubsync":"","hidden":false,"type":"get","isReference":false,"link_external":false,"body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Location Manager\",\n \"body\": \"Managers are limited to their location. Organization administrators have access in all locations.\"\n}\n[/block]","category":"573bb2522cf9af3200d588b3","editedParams":true,"link_url":"","version":"56fa046648e69f0e00a7742f","api":{"auth":"required","examples":{"codes":[{"language":"curl","code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/timeclocks/?active=true"}]},"method":"get","params":[{"ref":"","required":true,"desc":"ID of the organization","default":"","type":"int","name":"organization_id","in":"path","_id":"5717c29cab848c19009d10eb"},{"type":"int","name":"location_id","in":"path","_id":"5727a1af51a8c90e00bdb584","ref":"","required":true,"desc":"ID of the location","default":""},{"required":false,"desc":"Searches for timeclocks that start after this time (Iso8601 datetime)","default":"","type":"string","name":"start","in":"query","_id":"573bb30cf09c292200b39736","ref":""},{"ref":"","required":false,"type":"string","in":"query","_id":"573bb30cf09c292200b39735","default":"","desc":"Searches for timeclocks that start before this time (Iso8601 datetime)","name":"end"},{"_id":"573bb30cf09c292200b39734","default":"","desc":"If true, will only search for active timeclocks","name":"active","ref":"","required":false,"type":"boolean","in":"query"}],"results":{"codes":[{"name":"","code":"{\n \"data\": [\n {\n \"id\": 114, \n \"role_id\": 1, \n \"start\": \"2016-05-18T01:38:31\", \n \"stop\": null, \n \"user_id\": 2\n }\n ]\n}","language":"json","status":200}]},"settings":"","url":"/organizations/:organization_id/locations/:location_id/timeclocks/"},"editedParams2":true,"excerpt":"","updates":[],"user":"561da5369ace800d00289ea3","__v":0,"createdAt":"2016-05-18T00:11:26.806Z","sync_unique":"","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
getLocation Timeclocks
Path Params
Query Params
Permission Required: Location Manager
Managers are limited to their location. Organization administrators have access in all locations.
{"_id":"573bb33aee2b3b2200422954","hidden":false,"isReference":false,"link_external":false,"link_url":"","order":2,"slug":"location-time-off-requests","version":"56fa046648e69f0e00a7742f","category":"573bb2522cf9af3200d588b3","githubsync":"","parentDoc":null,"sync_unique":"","type":"get","editedParams2":true,"updates":[],"__v":0,"api":{"auth":"required","examples":{"codes":[{"language":"curl","code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/timeoffrequests/?start=2016-05-01&end=2016-05-31"}]},"method":"get","params":[{"default":"","type":"int","name":"organization_id","in":"path","_id":"5717c29cab848c19009d10eb","ref":"","required":true,"desc":"ID of the organization"},{"in":"path","_id":"5727a1af51a8c90e00bdb584","ref":"","required":true,"desc":"ID of the location","default":"","type":"int","name":"location_id"},{"name":"start","in":"query","_id":"573bb30cf09c292200b39736","ref":"","required":false,"desc":"Searches for timeclocks that start after this time (Iso8601 datetime)","default":"","type":"string"},{"desc":"Searches for shifts that start before this time (Iso8601 datetime)","default":"","type":"string","name":"end","in":"query","_id":"573bb30cf09c292200b39735","ref":"","required":false},{"type":"string","in":"query","_id":"573bb30cf09c292200b39734","default":"","desc":"Filter results by a specific state","name":"state","ref":"","required":false}],"results":{"codes":[{"name":"","code":"{\n \"data\": [\n {\n \"start\": \"2016-05-26T07:00:00\",\n \"state\": \"approved_paid\",\n \"user_id\": 1,\n \"approver_user_id\": 2,\n \"minutes_paid\": 240,\n \"stop\": \"2016-05-27T07:00:00\",\n \"id\": 368,\n \"role_id\": 656\n },\n {\n \"start\": \"2016-05-11T07:00:00\",\n \"state\": \"approved_unpaid\",\n \"user_id\": 2,\n \"approver_user_id\": 2,\n \"minutes_paid\": 480,\n \"stop\": \"2016-05-12T07:00:00\",\n \"id\": 369,\n \"role_id\": 656\n },\n ]\n}","language":"json","status":200}]},"settings":"","url":"/organizations/:organization_id/locations/:location_id/timeoffrequests/"},"body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Location Manager\",\n \"body\": \"Managers are limited to their location. Organization administrators have access in all locations.\"\n}\n[/block]","createdAt":"2016-05-18T00:11:38.394Z","editedParams":true,"excerpt":"","project":"56f9fe2cf9102d0e00ca623e","title":"Location Time Off Requests","user":"561da5369ace800d00289ea3","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
getLocation Time Off Requests
Path Params
Query Params
Permission Required: Location Manager
Managers are limited to their location. Organization administrators have access in all locations.
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/timeoffrequests/?start=2016-05-01&end=2016-05-31
Result Format
{
"data": [
{
"start": "2016-05-26T07:00:00",
"state": "approved_paid",
"user_id": 1,
"approver_user_id": 2,
"minutes_paid": 240,
"stop": "2016-05-27T07:00:00",
"id": 368,
"role_id": 656
},
{
"start": "2016-05-11T07:00:00",
"state": "approved_unpaid",
"user_id": 2,
"approver_user_id": 2,
"minutes_paid": 480,
"stop": "2016-05-12T07:00:00",
"id": 369,
"role_id": 656
},
]
}
{"_id":"5727a161872d4e0e000a9167","sync_unique":"","githubsync":"","link_external":false,"project":"56f9fe2cf9102d0e00ca623e","slug":"all-managers","version":"56fa046648e69f0e00a7742f","api":{"params":[{"name":"organization_id","in":"path","_id":"5717c29cab848c19009d10eb","ref":"","required":true,"desc":"ID of the organization","default":"","type":"int"},{"desc":"ID of the location","default":"","type":"int","name":"location_id","in":"path","_id":"5727a1af51a8c90e00bdb584","ref":"","required":true}],"results":{"codes":[{"status":200,"language":"json","code":"{\n \"data\": [\n {\n \"username\": null,\n \"confirmed\": true,\n \"name\": \"Leonhard Euler\",\n \"active\": true,\n \"member_since\": \"2015-11-08T23:05:26\",\n \"last_seen\": \"2016-04-22T21:26:44\",\n \"sudo\": false,\n \"email\": \"[email protected]\",\n \"id\": 421\n }\n ]\n}","name":""}]},"settings":"","url":"/organizations/:organization_id/locations/:location_id/managers/","auth":"required","examples":{"codes":[{"code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/managers/","language":"curl"}]},"method":"get"},"editedParams2":true,"isReference":false,"parentDoc":null,"type":"get","body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Location Manager\",\n \"body\": \"Managers are limited to their location. Organization administrators have access in all locations.\"\n}\n[/block]","createdAt":"2016-05-02T18:50:09.445Z","link_url":"","title":"All Managers","excerpt":"","hidden":false,"order":0,"updates":[],"__v":1,"category":"57279c1e90a5580e0041908b","editedParams":true,"user":"561da5369ace800d00289ea3","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
getAll Managers
Path Params
Permission Required: Location Manager
Managers are limited to their location. Organization administrators have access in all locations.
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/managers/
Result Format
{
"data": [
{
"username": null,
"confirmed": true,
"name": "Leonhard Euler",
"active": true,
"member_since": "2015-11-08T23:05:26",
"last_seen": "2016-04-22T21:26:44",
"sudo": false,
"email": "[email protected]",
"id": 421
}
]
}
{"_id":"5727a16dbd0e510e00a888dc","category":"57279c1e90a5580e0041908b","type":"post","githubsync":"","order":1,"slug":"create-a-manager","updates":[],"user":"561da5369ace800d00289ea3","__v":1,"editedParams":true,"editedParams2":true,"createdAt":"2016-05-02T18:50:21.517Z","hidden":false,"link_url":"","parentDoc":null,"version":"56fa046648e69f0e00a7742f","api":{"method":"post","params":[{"desc":"ID of the organization","default":"","type":"int","name":"organization_id","in":"path","_id":"57166b4cb5af590e00a0ffc7","ref":"","required":true},{"ref":"","required":true,"desc":"ID of the location","default":"","type":"string","name":"location_id","in":"path","_id":"5727a221872d4e0e000a916a"},{"desc":"If known, a User ID is the best way to add a user as a manager","name":"id","ref":"","required":false,"type":"string","in":"body","_id":"571a960aee0bfe170037342a","default":""},{"ref":"","required":false,"type":"string","in":"body","_id":"571a960dd2ed1c17005a7962","default":"","desc":"If the User ID is not known, a manager can be added as an admin via their email address. Use the email address if the user does not currently have a Staffjoy account.","name":"email"},{"_id":"57166b4cb5af590e00a0ffc6","default":"","desc":"If the user is being invited to sign up for Staffjoy, a name can optionally be given to the manager","name":"name","ref":"","required":false,"type":"string","in":"body"}],"results":{"codes":[{"status":201,"language":"json","code":"{\n \"username\": null,\n \"confirmed\": true,\n \"name\": \"Leonhard Euler\",\n \"active\": true,\n \"member_since\": \"2015-11-08T23:05:26\",\n \"last_seen\": \"2016-04-22T21:26:44\",\n \"sudo\": false,\n \"email\": \"[email protected]\",\n \"id\": 421\n}","name":""}]},"settings":"","url":"/organizations/:organization_id/locations/:location_id/managers/","auth":"required","examples":{"codes":[{"code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/managers/ -X POST -d \"[email protected]\"","language":"curl"}]}},"body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Location Manager\",\n \"body\": \"Managers are limited to their location. Organization administrators have access in all locations.\"\n}\n[/block]","project":"56f9fe2cf9102d0e00ca623e","sync_unique":"","title":"Create a Manager","excerpt":"","isReference":false,"link_external":false,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
postCreate a Manager
Path Params
Body Params
Permission Required: Location Manager
Managers are limited to their location. Organization administrators have access in all locations.
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/managers/ -X POST -d "[email protected]"
Result Format
{
"username": null,
"confirmed": true,
"name": "Leonhard Euler",
"active": true,
"member_since": "2015-11-08T23:05:26",
"last_seen": "2016-04-22T21:26:44",
"sudo": false,
"email": "[email protected]",
"id": 421
}
{"_id":"5727a17a51a8c90e00bdb583","link_external":false,"project":"56f9fe2cf9102d0e00ca623e","category":"57279c1e90a5580e0041908b","createdAt":"2016-05-02T18:50:34.586Z","githubsync":"","isReference":false,"title":"Manager","type":"get","updates":[],"user":"561da5369ace800d00289ea3","api":{"auth":"required","examples":{"codes":[{"language":"curl","code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/managers/421"}]},"method":"get","params":[{"_id":"57167483b5af590e00a0fff0","ref":"","required":true,"desc":"ID of the organization","default":"","type":"int","name":"organization_id","in":"path"},{"_id":"5727a9980fe9c40e005ba916","ref":"","required":true,"desc":"ID of the location","default":"","type":"int","name":"location_id","in":"path"},{"in":"path","_id":"57167483b5af590e00a0ffef","ref":"","required":true,"desc":"ID of the user","default":"","type":"int","name":"user_id"}],"results":{"codes":[{"status":200,"language":"json","code":"{\n \"data\": {\n \"username\": null,\n \"confirmed\": true,\n \"name\": \"Leonhard Euler\",\n \"active\": true,\n \"member_since\": \"2015-11-08T23:05:26\",\n \"last_seen\": \"2016-04-22T21:26:44\",\n \"sudo\": false,\n \"email\": \"[email protected]\",\n \"id\": 421\n },\n \"resources\": []\n}","name":""}]},"settings":"","url":"/organizations/:organization_id/locations/:location_id/managers/:user_id"},"editedParams":true,"parentDoc":null,"sync_unique":"","version":"56fa046648e69f0e00a7742f","slug":"manager","hidden":false,"link_url":"","order":2,"__v":1,"body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Location Manager\",\n \"body\": \"Managers are limited to their location. Organization administrators have access in all locations.\"\n}\n[/block]","editedParams2":true,"excerpt":"","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
getManager
Path Params
Permission Required: Location Manager
Managers are limited to their location. Organization administrators have access in all locations.
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/managers/421
Result Format
{
"data": {
"username": null,
"confirmed": true,
"name": "Leonhard Euler",
"active": true,
"member_since": "2015-11-08T23:05:26",
"last_seen": "2016-04-22T21:26:44",
"sudo": false,
"email": "[email protected]",
"id": 421
},
"resources": []
}
{"_id":"57279fb790a5580e0041909f","link_url":"","order":3,"slug":"modify-a-manager","updates":[],"__v":1,"category":"57279c1e90a5580e0041908b","githubsync":"","editedParams":true,"sync_unique":"","version":"56fa046648e69f0e00a7742f","isReference":false,"title":"Modify a Manager","user":"561da5369ace800d00289ea3","body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Location Manager\",\n \"body\": \"Managers are limited to their location. Organization administrators have access in all locations.\"\n}\n[/block]","createdAt":"2016-05-02T18:43:03.659Z","excerpt":"","hidden":false,"project":"56f9fe2cf9102d0e00ca623e","type":"patch","api":{"method":"patch","params":[{"desc":"ID of the organization","default":"","type":"int","name":"organization_id","in":"path","_id":"57167483b5af590e00a0fff0","ref":"","required":true},{"name":"location_id","in":"path","_id":"5727a04651a8c90e00bdb57a","ref":"","required":true,"desc":"ID of the location","default":"","type":"int"},{"desc":"ID of the user","default":"","type":"int","name":"user_id","in":"path","_id":"57167483b5af590e00a0ffef","ref":"","required":true},{"ref":"","required":false,"desc":"an email will be sent to remind the user to sign up for Staffjoy","default":"","type":"boolean","name":"activateReminder","in":"body","_id":"57279fac0fe9c40e005ba8eb"}],"results":{"codes":[{"code":"{}","name":"","status":204,"language":"json"}]},"settings":"","url":"/organizations/:organization_id/locations/:location_id/managers/:user_id","auth":"required","examples":{"codes":[{"language":"curl","code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/managers/2 -X PATCH -d \"activateReminder=true\""}]}},"editedParams2":true,"link_external":false,"parentDoc":null,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
patchModify a Manager
Path Params
Body Params
Permission Required: Location Manager
Managers are limited to their location. Organization administrators have access in all locations.
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/managers/2 -X PATCH -d "activateReminder=true"
Result Format
{"_id":"5727aa650fe9c40e005ba919","__v":0,"link_external":false,"order":4,"slug":"delete-a-manager","sync_unique":"","type":"delete","body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Location Manager\",\n \"body\": \"Managers are limited to their location. Organization administrators have access in all locations.\"\n}\n[/block]","category":"57279c1e90a5580e0041908b","link_url":"","parentDoc":null,"project":"56f9fe2cf9102d0e00ca623e","api":{"results":{"codes":[{"status":204,"language":"json","code":"{}","name":""}]},"settings":"","url":"/organizations/:organization_id/locations/:location_id/managers/:user_id","auth":"required","examples":{"codes":[{"language":"curl","code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/managers/421 -X DELETE"}]},"method":"delete","params":[{"name":"organization_id","in":"path","_id":"57167483b5af590e00a0fff0","ref":"","required":true,"desc":"ID of the organization","default":"","type":"int"},{"default":"","type":"int","name":"location_id","in":"path","_id":"5727a9980fe9c40e005ba916","ref":"","required":true,"desc":"ID of the location"},{"_id":"57167483b5af590e00a0ffef","ref":"","required":true,"desc":"ID of the user","default":"","type":"int","name":"user_id","in":"path"}]},"createdAt":"2016-05-02T19:28:37.422Z","githubsync":"","isReference":false,"updates":[],"user":"561da5369ace800d00289ea3","version":"56fa046648e69f0e00a7742f","editedParams":true,"editedParams2":true,"excerpt":"","hidden":false,"title":"Delete a Manager","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
deleteDelete a Manager
Path Params
Permission Required: Location Manager
Managers are limited to their location. Organization administrators have access in all locations.
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/managers/421 -X DELETE
Result Format
{"_id":"57169f4eed1e5e2000bd684a","category":"57169d0dbdc0fe2000fc4f5b","link_external":false,"order":0,"title":"Location Attendance","type":"get","body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Location Manager\",\n \"body\": \"Managers are limited to their location. Organization administrators have access in all locations.\"\n}\n[/block]\n* The response gives all activity for each worker, grouped by each day.\n* Each day is recognized as midnight to midnight on the calendar date of the location's timezone.\n* All timestamps returned are in Iso8601 format and in UTC time.","editedParams":true,"editedParams2":true,"hidden":false,"sync_unique":"","slug":"location-attendance","updates":[],"api":{"method":"get","params":[{"default":"","type":"int","name":"organization_id","in":"path","_id":"57169f4eed1e5e2000bd684e","ref":"","required":true,"desc":"ID of the organization"},{"in":"path","_id":"57169f4eed1e5e2000bd684d","ref":"","required":true,"desc":"ID of the location","default":"","type":"int","name":"location_id"},{"default":"","desc":"the start date of the query","name":"startDate","ref":"","required":true,"type":"yyyy-mm-dd","in":"query","_id":"57169f4eed1e5e2000bd684c"},{"desc":"the end date of the query","name":"endDate","ref":"","required":true,"type":"yyyy-mm-dd","in":"query","_id":"57169f4eed1e5e2000bd684b","default":""}],"results":{"codes":[{"language":"json","code":"{\n \"data\": {\n \"2016-04-05\": [\n {\n \"time_off_requests\": null,\n \"user_id\": 1,\n \"role_id\": 656,\n \"timeclocks\": [\n {\n \"user_id\": 1,\n \"stop\": \"2016-04-06T15:57:57\",\n \"role_id\": 656,\n \"organization_id\": 1,\n \"start\": \"2016-04-05T23:43:32\",\n \"location_id\": 6,\n \"id\": 7140\n }\n ],\n \"shifts\": [],\n \"logged_time\": 58465\n },\n {\n \"time_off_requests\": null,\n \"user_id\": 706,\n \"role_id\": 656,\n \"timeclocks\": [\n {\n \"user_id\": 706,\n \"stop\": \"2016-04-06T02:10:07\",\n \"role_id\": 656,\n \"organization_id\": 1,\n \"start\": \"2016-04-05T16:39:37\",\n \"location_id\": 6,\n \"id\": 7100\n }\n ],\n \"shifts\": [\n {\n \"user_id\": 706,\n \"stop\": \"2016-04-06T00:00:00\",\n \"role_id\": 656,\n \"start\": \"2016-04-05T16:00:00\",\n \"published\": true,\n \"user_name\": \"Marc Schechter\",\n \"id\": 41674\n }\n ],\n \"logged_time\": 34230\n },\n {\n \"time_off_requests\": null,\n \"user_id\": 674,\n \"role_id\": 657,\n \"timeclocks\": [\n {\n \"user_id\": 674,\n \"stop\": \"2016-04-06T05:09:14\",\n \"role_id\": 657,\n \"organization_id\": 1,\n \"start\": \"2016-04-06T03:17:33\",\n \"location_id\": 6,\n \"id\": 7144\n }\n ],\n \"shifts\": [],\n \"logged_time\": 6701\n }\n ]\n },\n \"summary\": [\n {\n \"scheduled_time\": 0,\n \"shift_count\": 0,\n \"user_id\": 1,\n \"timeclock_count\": 1,\n \"time_off_request_count\": 0,\n \"role_id\": 656,\n \"logged_time\": 58465\n },\n {\n \"scheduled_time\": 28800,\n \"shift_count\": 1,\n \"user_id\": 706,\n \"timeclock_count\": 1,\n \"time_off_request_count\": 0,\n \"role_id\": 656,\n \"logged_time\": 34230\n },\n {\n \"scheduled_time\": 0,\n \"shift_count\": 0,\n \"user_id\": 674,\n \"timeclock_count\": 1,\n \"time_off_request_count\": 0,\n \"role_id\": 657,\n \"logged_time\": 6701\n }\n ]\n}","name":"","status":200}]},"settings":"","url":"/organizations/:organization_id/locations/:location_id/attendance/","auth":"required","examples":{"codes":[{"language":"curl","code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/attendance/ -d \"startDate=2016-04-05\" -d \"endDate=2016-04-05\""}]}},"createdAt":"2016-04-19T21:12:46.695Z","excerpt":"This is a read-only endpoint that collects and groups data for shifts, timeclocks, and time off requests.","parentDoc":null,"project":"56f9fe2cf9102d0e00ca623e","user":"561da5369ace800d00289ea3","version":"56fa046648e69f0e00a7742f","__v":0,"githubsync":"","isReference":false,"link_url":"","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
getLocation Attendance
Path Params
Query Params
Permission Required: Location Manager
Managers are limited to their location. Organization administrators have access in all locations.
- The response gives all activity for each worker, grouped by each day.
- Each day is recognized as midnight to midnight on the calendar date of the location's timezone.
- All timestamps returned are in Iso8601 format and in UTC time.
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/attendance/ -d "startDate=2016-04-05" -d "endDate=2016-04-05"
Result Format
{
"data": {
"2016-04-05": [
{
"time_off_requests": null,
"user_id": 1,
"role_id": 656,
"timeclocks": [
{
"user_id": 1,
"stop": "2016-04-06T15:57:57",
"role_id": 656,
"organization_id": 1,
"start": "2016-04-05T23:43:32",
"location_id": 6,
"id": 7140
}
],
"shifts": [],
"logged_time": 58465
},
{
"time_off_requests": null,
"user_id": 706,
"role_id": 656,
"timeclocks": [
{
"user_id": 706,
"stop": "2016-04-06T02:10:07",
"role_id": 656,
"organization_id": 1,
"start": "2016-04-05T16:39:37",
"location_id": 6,
"id": 7100
}
],
"shifts": [
{
"user_id": 706,
"stop": "2016-04-06T00:00:00",
"role_id": 656,
"start": "2016-04-05T16:00:00",
"published": true,
"user_name": "Marc Schechter",
"id": 41674
}
],
"logged_time": 34230
},
{
"time_off_requests": null,
"user_id": 674,
"role_id": 657,
"timeclocks": [
{
"user_id": 674,
"stop": "2016-04-06T05:09:14",
"role_id": 657,
"organization_id": 1,
"start": "2016-04-06T03:17:33",
"location_id": 6,
"id": 7144
}
],
"shifts": [],
"logged_time": 6701
}
]
},
"summary": [
{
"scheduled_time": 0,
"shift_count": 0,
"user_id": 1,
"timeclock_count": 1,
"time_off_request_count": 0,
"role_id": 656,
"logged_time": 58465
},
{
"scheduled_time": 28800,
"shift_count": 1,
"user_id": 706,
"timeclock_count": 1,
"time_off_request_count": 0,
"role_id": 656,
"logged_time": 34230
},
{
"scheduled_time": 0,
"shift_count": 0,
"user_id": 674,
"timeclock_count": 1,
"time_off_request_count": 0,
"role_id": 657,
"logged_time": 6701
}
]
}
{"_id":"57167abfb5af590e00a1001b","sync_unique":"","type":"get","project":"56f9fe2cf9102d0e00ca623e","slug":"all-roles","title":"All Roles","editedParams2":true,"parentDoc":null,"excerpt":"","githubsync":"","hidden":false,"isReference":false,"order":0,"updates":[],"__v":1,"api":{"auth":"required","examples":{"codes":[{"code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/","language":"curl"}]},"method":"get","params":[{"type":"int","name":"organization_id","in":"path","_id":"57167bd1893cbe0e002d76e3","ref":"","required":true,"desc":"ID of the organization","default":""},{"type":"int","name":"location_id","in":"path","_id":"57167bd1893cbe0e002d76e2","ref":"","required":true,"desc":"ID of the location","default":""},{"required":false,"desc":"If true, all corresponding workers will be returned with each result","default":"","type":"boolean","name":"recurse","in":"query","_id":"57167bd1893cbe0e002d76e1","ref":""},{"default":"","type":"boolean","name":"archived","in":"query","_id":"57167bd1893cbe0e002d76e0","ref":"","required":false,"desc":"Filter results by the archived flag. Use false to return only current roles"}],"results":{"codes":[{"name":"","code":"{\n \"data\": [\n {\n \"max_hours_per_workday\": 8,\n \"archived\": false,\n \"enable_timeclock\": true,\n \"name\": \"Hackers\",\n \"max_consecutive_workdays\": 6,\n \"min_hours_between_shifts\": 12,\n \"enable_time_off_requests\": true,\n \"location_id\": 6,\n \"id\": 656,\n \"min_hours_per_workday\": 4\n },\n {\n \"max_hours_per_workday\": 8,\n \"archived\": false,\n \"enable_timeclock\": true,\n \"name\": \"Contracting\",\n \"max_consecutive_workdays\": 6,\n \"min_hours_between_shifts\": 12,\n \"enable_time_off_requests\": true,\n \"location_id\": 6,\n \"id\": 657,\n \"min_hours_per_workday\": 4\n }\n ]\n}","language":"json","status":200}]},"settings":"","url":"/organizations/:organization_id/locations/:location_id/roles/"},"user":"561da5369ace800d00289ea3","category":"56fbf8960023171700b9614c","createdAt":"2016-04-19T18:36:47.025Z","editedParams":true,"link_external":false,"link_url":"","version":"56fa046648e69f0e00a7742f","body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Location Member\",\n \"body\": \"Managers and workers within the location can access this in addition to organization administrators.\"\n}\n[/block]","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
getAll Roles
Path Params
Query Params
Permission Required: Location Member
Managers and workers within the location can access this in addition to organization administrators.
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/
Result Format
{
"data": [
{
"max_hours_per_workday": 8,
"archived": false,
"enable_timeclock": true,
"name": "Hackers",
"max_consecutive_workdays": 6,
"min_hours_between_shifts": 12,
"enable_time_off_requests": true,
"location_id": 6,
"id": 656,
"min_hours_per_workday": 4
},
{
"max_hours_per_workday": 8,
"archived": false,
"enable_timeclock": true,
"name": "Contracting",
"max_consecutive_workdays": 6,
"min_hours_between_shifts": 12,
"enable_time_off_requests": true,
"location_id": 6,
"id": 657,
"min_hours_per_workday": 4
}
]
}
{"_id":"57167ac5810df00e00cc7ac1","type":"post","body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Location Manager\",\n \"body\": \"Managers are limited to their location. Organization administrators have access in all locations.\"\n}\n[/block]","createdAt":"2016-04-19T18:36:53.233Z","editedParams2":true,"excerpt":"","parentDoc":null,"project":"56f9fe2cf9102d0e00ca623e","slug":"create-role","user":"561da5369ace800d00289ea3","api":{"params":[{"name":"organization_id","in":"path","_id":"571681b95d90dc170060efb4","ref":"","required":true,"desc":"ID of the organization","default":"","type":"int"},{"name":"location_id","ref":"","required":true,"type":"int","in":"path","_id":"571681b95d90dc170060efb3","default":"","desc":"ID of the location"},{"ref":"","required":false,"desc":"The name of the role","default":"","type":"string","name":"name","in":"body","_id":"571681b95d90dc170060efb2"},{"type":"int","name":"min_hours_per_workday","in":"body","_id":"571681b95d90dc170060efb1","ref":"","required":false,"desc":"The minimum amount of hours each worker of the role can be scheduled for on a given workday","default":""},{"type":"int","name":"max_hours_per_workday","in":"body","_id":"571681b95d90dc170060efb0","ref":"","required":false,"desc":"The maximum amount of hours each worker of the role can be scheduled for on a given workday","default":""},{"type":"int","name":"max_consecutive_workdays","in":"body","_id":"571681b95d90dc170060efaf","ref":"","required":false,"desc":"The maximum amount of consecutive workdays that a worker is allowed to work","default":""},{"type":"int","name":"min_hours_between_shifts","in":"body","_id":"571681b95d90dc170060efae","ref":"","required":false,"desc":"Define the minimum amount of time workers will be given between each shift","default":""},{"type":"boolean","name":"enable_timeclock","in":"body","_id":"571681b95d90dc170060efad","ref":"","required":false,"desc":"Allow workers to use the timeclock in My Schedules. If undefined, inherits from the organization default.","default":""},{"required":false,"desc":"Allow workers to make time off requests in My Schedules. If undefined, inherits from the organization default.","default":"","type":"boolean","name":"enable_time_off_requests","in":"body","_id":"571681b95d90dc170060efac","ref":""}],"results":{"codes":[{"name":"","code":"{\n \"max_hours_per_workday\": 8,\n \"archived\": false,\n \"enable_timeclock\": true,\n \"name\": \"Dispatchers\",\n \"max_consecutive_workdays\": 6,\n \"min_hours_between_shifts\": 12,\n \"enable_time_off_requests\": false,\n \"location_id\": 6,\n \"id\": 1042,\n \"min_hours_per_workday\": 4\n}","language":"json","status":201}]},"settings":"","url":"/organizations/:organization_id/locations/:location_id/roles/","auth":"required","examples":{"codes":[{"code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/ -X POST -d \"name=Dispatchers\"","language":"curl"}]},"method":"post"},"githubsync":"","hidden":false,"order":1,"link_external":false,"title":"Create Role","updates":[],"__v":2,"category":"56fbf8960023171700b9614c","editedParams":true,"isReference":false,"link_url":"","sync_unique":"","version":"56fa046648e69f0e00a7742f","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
postCreate Role
Path Params
Body Params
Permission Required: Location Manager
Managers are limited to their location. Organization administrators have access in all locations.
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/ -X POST -d "name=Dispatchers"
Result Format
{
"max_hours_per_workday": 8,
"archived": false,
"enable_timeclock": true,
"name": "Dispatchers",
"max_consecutive_workdays": 6,
"min_hours_between_shifts": 12,
"enable_time_off_requests": false,
"location_id": 6,
"id": 1042,
"min_hours_per_workday": 4
}
{"_id":"57167ad8b5af590e00a1001f","editedParams2":true,"slug":"role","version":"56fa046648e69f0e00a7742f","hidden":false,"api":{"url":"/organizations/:organization_id/locations/:location_id/roles/:role_id","auth":"required","examples":{"codes":[{"language":"curl","code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656"}]},"method":"get","params":[{"ref":"","required":true,"desc":"ID of the organization","default":"","type":"int","name":"organization_id","in":"path","_id":"571686df8d31b1190098dde7"},{"required":true,"desc":"ID of the location","default":"","type":"int","name":"location_id","in":"path","_id":"571686df8d31b1190098dde6","ref":""},{"default":"","type":"int","name":"role_id","in":"path","_id":"571686df8d31b1190098dde5","ref":"","required":true,"desc":"Id of the role"},{"in":"query","_id":"571686df8d31b1190098dde4","ref":"","required":false,"desc":"f true, all corresponding workers will be returned with the response.","default":"","type":"boolean","name":"recurse"},{"name":"archived","in":"query","_id":"571686df8d31b1190098dde3","ref":"","required":false,"desc":"If recurse is set to true, this parameter will filter workers by their archived property. Use false to return only active workers.","default":"","type":"string"}],"results":{"codes":[{"name":"","code":"{\n \"data\": {\n \"max_hours_per_workday\": 8,\n \"archived\": false,\n \"enable_timeclock\": true,\n \"name\": \"Hackers\",\n \"max_consecutive_workdays\": 6,\n \"min_hours_between_shifts\": 12,\n \"enable_time_off_requests\": true,\n \"location_id\": 6,\n \"id\": 656,\n \"min_hours_per_workday\": 4\n },\n \"resources\": [\n \"recurringshifts\",\n \"schedules\",\n \"shifts\",\n \"users\"\n ]\n}","language":"json","status":200}]},"settings":""},"editedParams":true,"createdAt":"2016-04-19T18:37:12.451Z","excerpt":"","link_external":false,"link_url":"","parentDoc":null,"__v":1,"body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Location Member\",\n \"body\": \"Managers and workers within the location can access this in addition to organization administrators\"\n}\n[/block]","category":"56fbf8960023171700b9614c","type":"get","updates":[],"user":"561da5369ace800d00289ea3","project":"56f9fe2cf9102d0e00ca623e","sync_unique":"","title":"Role","githubsync":"","isReference":false,"order":2,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
getRole
Path Params
Query Params
Permission Required: Location Member
Managers and workers within the location can access this in addition to organization administrators
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656
Result Format
{
"data": {
"max_hours_per_workday": 8,
"archived": false,
"enable_timeclock": true,
"name": "Hackers",
"max_consecutive_workdays": 6,
"min_hours_between_shifts": 12,
"enable_time_off_requests": true,
"location_id": 6,
"id": 656,
"min_hours_per_workday": 4
},
"resources": [
"recurringshifts",
"schedules",
"shifts",
"users"
]
}
{"_id":"57167ae43389e81900a48967","category":"56fbf8960023171700b9614c","createdAt":"2016-04-19T18:37:24.285Z","githubsync":"","slug":"modify-a-role","api":{"examples":{"codes":[{"language":"curl","code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656 -X PATCH -d \"name=Agents\""}]},"method":"patch","params":[{"default":"","type":"int","name":"organization_id","in":"path","_id":"5716930bec324f0e00b58044","ref":"","required":true,"desc":"ID of the organization"},{"in":"path","_id":"5716930bec324f0e00b58043","ref":"","required":true,"desc":"ID of the location","default":"","type":"int","name":"location_id"},{"ref":"","required":true,"desc":"ID of the role","default":"","type":"int","name":"role_id","in":"path","_id":"5716930bec324f0e00b58042"},{"type":"string","name":"name","in":"body","_id":"5716953da2892f0e0014bdfb","ref":"","required":false,"desc":"The name of the role","default":""},{"type":"int","name":"min_hours_per_workday","in":"body","_id":"5716930bec324f0e00b58041","ref":"","required":false,"desc":"The minimum amount of hours each worker of the role can be scheduled for on a given workday","default":""},{"required":false,"desc":"The maximum amount of hours each worker of the role can be scheduled for on a given workday","default":"","type":"int","name":"max_hours_per_workday","in":"body","_id":"5716930bec324f0e00b58040","ref":""},{"desc":"The maximum amount of consecutive workdays that a worker is allowed to work","default":"","type":"int","name":"max_consecutive_workdays","in":"body","_id":"5716930bec324f0e00b5803f","ref":"","required":false},{"name":"min_hours_between_shifts","in":"body","_id":"5716930bec324f0e00b5803e","ref":"","required":false,"desc":"Define the minimum amount of time workers will be given between each shift","default":"","type":"int"},{"default":"","type":"boolean","name":"enable_timeclocks","in":"body","_id":"5716930bec324f0e00b5803d","ref":"","required":false,"desc":"Toggle whether workers can use the timeclock from My Schedules"},{"in":"body","_id":"5716930bec324f0e00b5803c","ref":"","required":false,"desc":"Toggle whether workers can make time off requests from My Schedules","default":"","type":"boolean","name":"enable_time_off_requests"}],"results":{"codes":[{"status":200,"language":"json","code":"{\n \"name\": \"Agents\"\n}","name":""}]},"settings":"","url":"/organizations/:organization_id/locations/:location_id/roles/:role_id","auth":"required"},"body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Location Manager\",\n \"body\": \"Managers are limited to their location. Organization administrators have access in all locations.\\n\\nOnly Staffjoy support can use the archived parameters\"\n}\n[/block]","editedParams2":true,"hidden":false,"isReference":false,"type":"patch","__v":2,"editedParams":true,"excerpt":"","sync_unique":"","updates":[],"version":"56fa046648e69f0e00a7742f","link_external":false,"link_url":"","order":3,"parentDoc":null,"project":"56f9fe2cf9102d0e00ca623e","title":"Modify a Role","user":"561da5369ace800d00289ea3","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
patchModify a Role
Path Params
Body Params
Permission Required: Location Manager
Managers are limited to their location. Organization administrators have access in all locations.
Only Staffjoy support can use the archived parameters
{"_id":"57167af3810df00e00cc7ac4","user":"561da5369ace800d00289ea3","version":"56fa046648e69f0e00a7742f","editedParams2":true,"link_external":false,"link_url":"","sync_unique":"","type":"delete","__v":1,"body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Location Manager\",\n \"body\": \"Managers are limited to their location. Organization administrators have access in all locations.\"\n}\n[/block]","editedParams":true,"excerpt":"","parentDoc":null,"project":"56f9fe2cf9102d0e00ca623e","createdAt":"2016-04-19T18:37:39.944Z","githubsync":"","slug":"delete-role","updates":[],"api":{"params":[{"name":"organization_id","in":"path","_id":"571697b43d3c000e009f6f2f","ref":"","required":true,"desc":"ID of the organization","default":"","type":"int"},{"default":"","type":"int","name":"location_id","in":"path","_id":"571697b43d3c000e009f6f2e","ref":"","required":true,"desc":"ID of the location"},{"in":"path","_id":"571697b43d3c000e009f6f2d","ref":"","required":true,"desc":"ID of the role","default":"","type":"int","name":"role_id"}],"results":{"codes":[{"name":"","status":204,"language":"json","code":"{}"}]},"settings":"","url":"/organizations/:organization_id/locations/:location_id/roles/:role_id","auth":"required","examples":{"codes":[{"language":"curl","code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656 -X DELETE"}]},"method":"delete"},"category":"56fbf8960023171700b9614c","hidden":false,"isReference":false,"order":4,"title":"Delete Role","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
deleteDelete Role
Path Params
Permission Required: Location Manager
Managers are limited to their location. Organization administrators have access in all locations.
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656 -X DELETE
Result Format
{"_id":"57169c59e3ed402000b6c336","githubsync":"","project":"56f9fe2cf9102d0e00ca623e","sync_unique":"","title":"All Role Workers","type":"get","api":{"examples":{"codes":[{"language":"curl","code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/users/"}]},"method":"get","params":[{"_id":"57170de79610f71900a3cd82","ref":"","required":true,"desc":"ID of the organization","default":"","type":"int","name":"organization_id","in":"path"},{"_id":"57170de79610f71900a3cd81","ref":"","required":true,"desc":"ID of the location","default":"","type":"int","name":"location_id","in":"path"},{"_id":"57170de79610f71900a3cd80","ref":"","required":true,"desc":"ID of the role","default":"","type":"int","name":"role_id","in":"path"},{"_id":"57170e99d2a6510e00840900","ref":"","required":false,"desc":"Filter results by the archived flag. Use false to return only current workers","default":"","type":"boolean","name":"archived","in":"query"}],"results":{"codes":[{"name":"","code":"{\n \"data\": [\n {\n \"username\": \"lenny\",\n \"confirmed\": true,\n \"working_hours\": null,\n \"name\": \"Leonhard Euler\",\n \"internal_id\": null,\n \"member_since\": \"2015-02-14T20:53:31\",\n \"sudo\": true,\n \"archived\": false,\n \"min_hours_per_workweek\": 20,\n \"email\": \"[email protected]\",\n \"max_hours_per_workweek\": 40,\n \"active\": true,\n \"id\": 1,\n \"last_seen\": \"2016-04-20T16:32:17\"\n },\n {\n \"username\": \"rosalind\",\n \"confirmed\": true,\n \"working_hours\": null,\n \"name\": \"Rosalind Franklin\",\n \"internal_id\": null,\n \"member_since\": \"2015-02-14T20:53:31\",\n \"sudo\": true,\n \"archived\": false,\n \"min_hours_per_workweek\": 30,\n \"email\": \"[email protected]\",\n \"max_hours_per_workweek\": 40,\n \"active\": true,\n \"id\": 2,\n \"last_seen\": \"2016-04-20T16:34:26.065983\"\n },\n {\n \"username\": \"bahador\",\n \"confirmed\": true,\n \"working_hours\": {\n \"monday\": [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],\n \"tuesday\": [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],\n \"friday\": [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],\n \"wednesday\": [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],\n \"thursday\": [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],\n \"sunday\": [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],\n \"saturday\": [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]\n },\n \"name\": \"bahador\",\n \"internal_id\": null,\n \"member_since\": \"2015-11-11T18:43:07\",\n \"sudo\": true,\n \"archived\": false,\n \"min_hours_per_workweek\": 20,\n \"email\": \"[email protected]\",\n \"max_hours_per_workweek\": 40,\n \"active\": true,\n \"id\": 458,\n \"last_seen\": \"2016-04-18T18:11:04\"\n },\n {\n \"username\": \"nikola\",\n \"confirmed\": true,\n \"working_hours\": null,\n \"name\": \"Nikola Tesla\",\n \"internal_id\": null,\n \"member_since\": \"2016-02-15T20:15:42\",\n \"sudo\": true,\n \"archived\": false,\n \"min_hours_per_workweek\": 20,\n \"email\": \"[email protected]\",\n \"max_hours_per_workweek\": 29,\n \"active\": true,\n \"id\": 706,\n \"last_seen\": \"2016-04-18T06:22:07\"\n },\n ]\n}","language":"json","status":200}]},"settings":"","url":"/organizations/:organization_id/locations/:location_id/roles/:role_id/users/","auth":"required"},"category":"57169c48e3ed402000b6c333","excerpt":"","link_external":false,"parentDoc":null,"updates":[],"user":"561da5369ace800d00289ea3","createdAt":"2016-04-19T21:00:09.107Z","editedParams2":true,"order":0,"__v":3,"body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Location Manager\",\n \"body\": \"Managers are limited to their location. Organization administrators have access in all locations.\"\n}\n[/block]","hidden":false,"isReference":false,"link_url":"","slug":"all-role-workers","version":"56fa046648e69f0e00a7742f","editedParams":true,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
getAll Role Workers
Path Params
Query Params
Permission Required: Location Manager
Managers are limited to their location. Organization administrators have access in all locations.
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/users/
Result Format
{
"data": [
{
"username": "lenny",
"confirmed": true,
"working_hours": null,
"name": "Leonhard Euler",
"internal_id": null,
"member_since": "2015-02-14T20:53:31",
"sudo": true,
"archived": false,
"min_hours_per_workweek": 20,
"email": "[email protected]",
"max_hours_per_workweek": 40,
"active": true,
"id": 1,
"last_seen": "2016-04-20T16:32:17"
},
{
"username": "rosalind",
"confirmed": true,
"working_hours": null,
"name": "Rosalind Franklin",
"internal_id": null,
"member_since": "2015-02-14T20:53:31",
"sudo": true,
"archived": false,
"min_hours_per_workweek": 30,
"email": "[email protected]",
"max_hours_per_workweek": 40,
"active": true,
"id": 2,
"last_seen": "2016-04-20T16:34:26.065983"
},
{
"username": "bahador",
"confirmed": true,
"working_hours": {
"monday": [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
"tuesday": [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
"friday": [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
"wednesday": [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
"thursday": [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
"sunday": [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
"saturday": [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
},
"name": "bahador",
"internal_id": null,
"member_since": "2015-11-11T18:43:07",
"sudo": true,
"archived": false,
"min_hours_per_workweek": 20,
"email": "[email protected]",
"max_hours_per_workweek": 40,
"active": true,
"id": 458,
"last_seen": "2016-04-18T18:11:04"
},
{
"username": "nikola",
"confirmed": true,
"working_hours": null,
"name": "Nikola Tesla",
"internal_id": null,
"member_since": "2016-02-15T20:15:42",
"sudo": true,
"archived": false,
"min_hours_per_workweek": 20,
"email": "[email protected]",
"max_hours_per_workweek": 29,
"active": true,
"id": 706,
"last_seen": "2016-04-18T06:22:07"
},
]
}
{"_id":"57169c73bdc0fe2000fc4f53","title":"Create a Role Worker","type":"post","updates":[],"body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Location Manager\",\n \"body\": \"Managers are limited to their location. Organization administrators have access in all locations.\"\n}\n[/block]\nNote that either a User ID or an email address is required","category":"57169c48e3ed402000b6c333","slug":"create-a-role-worker","editedParams2":true,"githubsync":"","link_url":"","project":"56f9fe2cf9102d0e00ca623e","createdAt":"2016-04-19T21:00:35.069Z","editedParams":true,"link_external":false,"parentDoc":null,"user":"561da5369ace800d00289ea3","hidden":false,"isReference":false,"order":1,"sync_unique":"","version":"56fa046648e69f0e00a7742f","__v":3,"api":{"results":{"codes":[{"status":201,"language":"json","code":"{\n \"username\": null,\n \"confirmed\": false,\n \"working_hours\": null,\n \"name\": \"George Dantzig\",\n \"internal_id\": null,\n \"member_since\": \"2015-10-22T02:49:48\",\n \"sudo\": false,\n \"archived\": false,\n \"min_hours_per_workweek\": 20,\n \"email\": \"[email protected]\",\n \"max_hours_per_workweek\": 29,\n \"active\": true,\n \"id\": 95,\n \"last_seen\": \"2015-10-22T02:49:48\"\n}","name":""}]},"settings":"","url":"/organizations/:organization_id/locations/:location_id/roles/:role_id/users/","auth":"required","examples":{"codes":[{"language":"curl","code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/users/ -X POST -d \"[email protected]\" -d \"min_hours_per_workweek=20\" -d \"max_hours_per_workweek=29\""}]},"method":"post","params":[{"type":"int","name":"organization_id","in":"path","_id":"57170de62be45f0e00caae4d","ref":"","required":true,"desc":"ID of the organization","default":""},{"required":true,"desc":"ID of the location","default":"","type":"int","name":"location_id","in":"path","_id":"57170de62be45f0e00caae4c","ref":""},{"desc":"ID of the role","default":"","type":"int","name":"role_id","in":"path","_id":"57170de62be45f0e00caae4b","ref":"","required":true},{"ref":"","required":false,"desc":"If known, a User ID is the best way to add a worker to a role","default":"","type":"int","name":"id","in":"body","_id":"57171078fdcb310e00f23e36"},{"type":"string","name":"email","in":"body","_id":"57171078fdcb310e00f23e35","ref":"","required":false,"desc":"If the User ID is not known, a user can be added as a worker via their email address. Use the email address if the worker does not currently have a Staffjoy account.","default":""},{"required":true,"type":"int","in":"body","_id":"57171078fdcb310e00f23e34","default":"","desc":"Determines the minimum amount of hours a worker is allowed to work during a workweek","name":"min_hours_per_workweek","ref":""},{"desc":"Determines the maximum amount of hours a worker is allowed to work during a workweek","name":"max_hours_per_workweek","ref":"","required":true,"type":"int","in":"body","_id":"57171078fdcb310e00f23e33","default":""},{"desc":"If the user is being invited to sign up for Staffjoy, a name can optionally be given to the worker","default":"","type":"string","name":"name","in":"body","_id":"57171078fdcb310e00f23e32","ref":"","required":false},{"name":"internal_id","in":"body","_id":"57171078fdcb310e00f23e31","ref":"","required":false,"desc":"An optional ID to help track workers across various systems","default":"","type":"string"},{"ref":"","required":false,"type":"string","in":"body","_id":"57171078fdcb310e00f23e30","default":"","desc":"Needs a serialized JSON structure of the same format used for setting demand, but only with binary data. 1 for available, 0 for unavailable.","name":"working_hours"}]},"excerpt":"","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
postCreate a Role Worker
Path Params
Body Params
Permission Required: Location Manager
Managers are limited to their location. Organization administrators have access in all locations.
Note that either a User ID or an email address is required
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/users/ -X POST -d "[email protected]" -d "min_hours_per_workweek=20" -d "max_hours_per_workweek=29"
Result Format
{
"username": null,
"confirmed": false,
"working_hours": null,
"name": "George Dantzig",
"internal_id": null,
"member_since": "2015-10-22T02:49:48",
"sudo": false,
"archived": false,
"min_hours_per_workweek": 20,
"email": "[email protected]",
"max_hours_per_workweek": 29,
"active": true,
"id": 95,
"last_seen": "2015-10-22T02:49:48"
}
{"_id":"57169c85f5b57c20005390bb","category":"57169c48e3ed402000b6c333","createdAt":"2016-04-19T21:00:53.316Z","githubsync":"","project":"56f9fe2cf9102d0e00ca623e","updates":[],"excerpt":"","isReference":false,"link_external":false,"link_url":"","slug":"role-worker","version":"56fa046648e69f0e00a7742f","body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Location Manager or Individual\",\n \"body\": \"Managers are limited to their location. Organization administrators have access in all locations. Workers are able to access their own data.\"\n}\n[/block]","api":{"examples":{"codes":[{"language":"curl","code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/users/2"}]},"method":"get","params":[{"required":true,"desc":"ID of the organization","default":"","type":"int","name":"organization_id","in":"path","_id":"57170e5a3cf2960e0009a3f7","ref":""},{"default":"","type":"int","name":"location_id","in":"path","_id":"57170e5a3cf2960e0009a3f6","ref":"","required":true,"desc":"ID of the location"},{"_id":"57170e5a3cf2960e0009a3f5","ref":"","required":true,"desc":"ID of the role","default":"","type":"int","name":"role_id","in":"path"},{"in":"path","_id":"57170e5a3cf2960e0009a3f4","ref":"","required":true,"desc":"ID of the user","default":"","type":"int","name":"user_id"}],"results":{"codes":[{"name":"","status":200,"language":"json","code":"{\n data: {\n \"username\": \"rosalind\",\n \"confirmed\": true,\n \"working_hours\": null,\n \"name\": \"Rosalind Franklin\",\n \"internal_id\": null,\n \"member_since\": \"2015-02-14T20:53:31\",\n \"sudo\": true,\n \"archived\": false,\n \"min_hours_per_workweek\": 30,\n \"email\": \"[email protected]\",\n \"max_hours_per_workweek\": 40,\n \"active\": true,\n \"id\": 2,\n \"last_seen\": \"2016-04-20T16:34:26.065983\"\n },\n \"resources\": [\n \"timeclocks\",\n \"timeoffrequests\"\n ]\n}\n \n \n ,"}]},"settings":"","url":"/organizations/:organization_id/locations/:location_id/roles/:role_id/users/:user_id","auth":"required"},"editedParams":true,"hidden":false,"title":"Role Worker","__v":2,"order":2,"parentDoc":null,"sync_unique":"","type":"get","user":"561da5369ace800d00289ea3","editedParams2":true,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
getRole Worker
Path Params
Permission Required: Location Manager or Individual
Managers are limited to their location. Organization administrators have access in all locations. Workers are able to access their own data.
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/users/2
Result Format
{
data: {
"username": "rosalind",
"confirmed": true,
"working_hours": null,
"name": "Rosalind Franklin",
"internal_id": null,
"member_since": "2015-02-14T20:53:31",
"sudo": true,
"archived": false,
"min_hours_per_workweek": 30,
"email": "[email protected]",
"max_hours_per_workweek": 40,
"active": true,
"id": 2,
"last_seen": "2016-04-20T16:34:26.065983"
},
"resources": [
"timeclocks",
"timeoffrequests"
]
}
,
{"_id":"57169c93e3ed402000b6c338","editedParams":true,"editedParams2":true,"link_url":"","project":"56f9fe2cf9102d0e00ca623e","slug":"modify-a-role-worker","user":"561da5369ace800d00289ea3","api":{"auth":"required","examples":{"codes":[{"language":"curl","code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/users/2 -X PATCH -d \"min_hours_per_workweek=25\"\n"}]},"method":"patch","params":[{"desc":"ID of the organization","default":"","type":"int","name":"organization_id","in":"path","_id":"57170e5e9610f71900a3cd87","ref":"","required":true},{"name":"location_id","in":"path","_id":"57170e5e9610f71900a3cd86","ref":"","required":true,"desc":"ID of the location","default":"","type":"int"},{"desc":"ID of the role","default":"","type":"int","name":"role_id","in":"path","_id":"57170e5e9610f71900a3cd85","ref":"","required":true},{"name":"user_id","in":"path","_id":"57170e5e9610f71900a3cd84","ref":"","required":true,"desc":"ID of the user","default":"","type":"int"},{"default":"","type":"int","name":"min_hours_per_workweek","in":"body","_id":"571711063cf2960e0009a3fe","ref":"","required":false,"desc":"Determines the minimum amount of hours a worker is allowed to work during a workweek"},{"in":"body","_id":"571711063cf2960e0009a3fd","ref":"","required":false,"desc":"Determines the maximum amount of hours a worker is allowed to work during a workweek","default":"","type":"int","name":"max_hours_per_workweek"},{"ref":"","required":false,"desc":"An optional ID to help track workers across various systems","default":"","type":"string","name":"internal_id","in":"body","_id":"571711063cf2960e0009a3fc"},{"required":false,"desc":"Needs a binary JSON structure of the same format used for setting demand","default":"","type":"object","name":"working_hours","in":"body","_id":"571711063cf2960e0009a3fb","ref":""}],"results":{"codes":[{"status":200,"language":"json","code":"{\n \"min_half_hours_per_workweek\": 50\n}","name":""}]},"settings":"","url":"/organizations/:organization_id/locations/:location_id/roles/:role_id/users/:user_id"},"category":"57169c48e3ed402000b6c333","type":"patch","version":"56fa046648e69f0e00a7742f","__v":3,"excerpt":"","link_external":false,"parentDoc":null,"body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Location Manager\",\n \"body\": \"Managers are limited to their location. Organization administrators have access in all locations.\"\n}\n[/block]","createdAt":"2016-04-19T21:01:07.317Z","githubsync":"","hidden":false,"isReference":false,"order":3,"sync_unique":"","title":"Modify a Role Worker","updates":[],"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
patchModify a Role Worker
Path Params
Body Params
Permission Required: Location Manager
Managers are limited to their location. Organization administrators have access in all locations.
{"_id":"57169c9ce3ed402000b6c33a","api":{"results":{"codes":[{"status":204,"language":"json","code":"{}","name":""}]},"settings":"","url":"/organizations/:organization_id/locations/:location_id/roles/:role_id/users/:user_id","auth":"required","examples":{"codes":[{"language":"curl","code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/users/2 -X DELETE"}]},"method":"delete","params":[{"desc":"ID of the organization","default":"","type":"int","name":"organization_id","in":"path","_id":"57170e619610f71900a3cd8b","ref":"","required":true},{"ref":"","required":true,"desc":"ID of the location","default":"","type":"int","name":"location_id","in":"path","_id":"57170e619610f71900a3cd8a"},{"type":"int","name":"role_id","in":"path","_id":"57170e619610f71900a3cd89","ref":"","required":true,"desc":"ID of the role","default":""},{"required":true,"desc":"ID of the user","default":"","type":"int","name":"user_id","in":"path","_id":"57170e619610f71900a3cd88","ref":""}]},"isReference":false,"link_external":false,"category":"57169c48e3ed402000b6c333","__v":3,"editedParams":true,"editedParams2":true,"excerpt":"","githubsync":"","link_url":"","order":4,"parentDoc":null,"slug":"delete-a-role-worker","sync_unique":"","type":"delete","updates":[],"body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Location Manager\",\n \"body\": \"Managers are limited to their location. Organization administrators have access in all locations.\"\n}\n[/block]","createdAt":"2016-04-19T21:01:16.353Z","hidden":false,"project":"56f9fe2cf9102d0e00ca623e","title":"Delete a Role Worker","user":"561da5369ace800d00289ea3","version":"56fa046648e69f0e00a7742f","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
deleteDelete a Role Worker
Path Params
Permission Required: Location Manager
Managers are limited to their location. Organization administrators have access in all locations.
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/users/2 -X DELETE
Result Format
{"_id":"5719204d4604d417003d2427","excerpt":"","project":"56f9fe2cf9102d0e00ca623e","__v":2,"api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","url":"","auth":"required","params":[]},"createdAt":"2016-04-21T18:47:41.980Z","githubsync":"","updates":[],"sync_unique":"","title":"Schedule Overview","body":"A schedule is used to coordinate actions related to shifts and is essential for creating, assigning, and publishing a schedule.\n\n## Attributes\n\n* id (int) - a unique identifier of the schedule\n* role_id (int) - maps the schedule to its Role\n* state (sting) - see [Schedule State Machine](doc:schedule-state-machine) for more info\n* demand (JSON) - an hour by hour representation of forecasted demand\n* start (Iso8601 datetime) - when the schedule starts\n* stop (Iso8601 datetime) - when the schedule stops\n* min_shift_length_hour (int) - the minimum number of hours calculated shifts are allowed to be\n* max_shift_length_hour (int) - the maximum number of hours calculated shifts are allowed to be\n\n\n## Schedule Start and Stop\n\nAll schedules start at midnight of their location's local timezone on the `organization.day_week_starts` property and are exactly 1 week long. So if `organization.day_week_starts` is \"monday\" and the location's timezone was \"America/Los_Angeles\", then all schedules will have a 'schedule.start` that corresponds to midnight on Monday in Pacific Time.\n\n## The Demand Object\n\nThe `demand` object has an attribute for each day of the week. Each attribute is an array of exactly 24 cells that represent each hour of the day. For example, 9am on Monday corresponds to the 9th index of the \"monday\" array. The API accepts demand as a serialized JSON.\n[block:code]\n{\n \"codes\": [\n {\n \"code\": \"demand: {\\n \\\"monday\\\": [0,0,0,0,0,0,0,0,0,3,4,5,5,5,4,3,3,2,0,0,0,0,0,0],\\n \\\"tuesday\\\": [0,0,0,0,0,0,0,0,0,3,4,5,5,5,4,3,3,2,0,0,0,0,0,0],\\n \\\"friday\\\": [0,0,0,0,0,0,0,0,0,3,4,5,5,5,4,3,3,2,0,0,0,0,0,0],\\n \\\"wednesday\\\": [0,0,0,0,0,0,0,0,0,3,4,5,5,5,4,3,3,2,0,0,0,0,0,0],\\n \\\"thursday\\\": [0,0,0,0,0,0,0,0,0,3,4,5,5,5,4,3,3,2,0,0,0,0,0,0],\\n \\\"sunday\\\": [0,0,0,0,0,0,0,0,0,3,4,5,5,5,4,3,3,2,0,0,0,0,0,0],\\n \\\"saturday\\\": [0,0,0,0,0,0,0,0,0,3,4,5,5,5,4,3,3,2,0,0,0,0,0,0]\\n}\",\n \"language\": \"json\"\n }\n ]\n}\n[/block]","hidden":false,"link_external":false,"link_url":"","parentDoc":null,"slug":"schedule-overview","version":"56fa046648e69f0e00a7742f","category":"56fbf8a0587e43170081eb55","isReference":false,"order":0,"type":"basic","user":"561da5369ace800d00289ea3","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
Schedule Overview
A schedule is used to coordinate actions related to shifts and is essential for creating, assigning, and publishing a schedule.
Attributes
- id (int) - a unique identifier of the schedule
- role_id (int) - maps the schedule to its Role
- state (sting) - see Schedule State Machine for more info
- demand (JSON) - an hour by hour representation of forecasted demand
- start (Iso8601 datetime) - when the schedule starts
- stop (Iso8601 datetime) - when the schedule stops
- min_shift_length_hour (int) - the minimum number of hours calculated shifts are allowed to be
- max_shift_length_hour (int) - the maximum number of hours calculated shifts are allowed to be
Schedule Start and Stop
All schedules start at midnight of their location's local timezone on the organization.day_week_starts
property and are exactly 1 week long. So if organization.day_week_starts
is "monday" and the location's timezone was "America/Los_Angeles", then all schedules will have a 'schedule.start` that corresponds to midnight on Monday in Pacific Time.
The Demand Object
The demand
object has an attribute for each day of the week. Each attribute is an array of exactly 24 cells that represent each hour of the day. For example, 9am on Monday corresponds to the 9th index of the "monday" array. The API accepts demand as a serialized JSON.
demand: {
"monday": [0,0,0,0,0,0,0,0,0,3,4,5,5,5,4,3,3,2,0,0,0,0,0,0],
"tuesday": [0,0,0,0,0,0,0,0,0,3,4,5,5,5,4,3,3,2,0,0,0,0,0,0],
"friday": [0,0,0,0,0,0,0,0,0,3,4,5,5,5,4,3,3,2,0,0,0,0,0,0],
"wednesday": [0,0,0,0,0,0,0,0,0,3,4,5,5,5,4,3,3,2,0,0,0,0,0,0],
"thursday": [0,0,0,0,0,0,0,0,0,3,4,5,5,5,4,3,3,2,0,0,0,0,0,0],
"sunday": [0,0,0,0,0,0,0,0,0,3,4,5,5,5,4,3,3,2,0,0,0,0,0,0],
"saturday": [0,0,0,0,0,0,0,0,0,3,4,5,5,5,4,3,3,2,0,0,0,0,0,0]
}
{"_id":"56fbf8aa0023171700b9614d","project":"56f9fe2cf9102d0e00ca623e","slug":"schedule-state-machine","version":"56fa046648e69f0e00a7742f","link_url":"","isReference":false,"parentDoc":null,"title":"Schedule State Machine","body":"Staffjoy uses a state machine to control the automation of shift creation, assignment, and publication. Changing the state of a schedule coordinates actions for all shifts that start during the schedule. Formally, this is defined by `schedule.start <= shift.start < schedule.stop`.\n\nFor reference, \"chomp\" refers to our internal engineering service that computes shifts from demand, and \"mobius\" refers to our internal engineering service that assigns workers to shifts. \n\n[block:image]\n{\n \"images\": [\n {\n \"image\": [\n \"https://files.readme.io/TEsuwWbbTw6ALOuI5noj_schedule2%20state%20machine.png\",\n \"schedule2 state machine.png\",\n \"850\",\n \"542\",\n \"#4cb4ab\",\n \"\"\n ],\n \"caption\": \"Allowed schedule state transitions. \\\"boss\\\" and \\\"flex\\\" refer to the package of the organization.\"\n }\n ]\n}\n[/block]\n## initial\n\nSchedules start in the `initial` state. When a user begins planning schedules in the front-end, we transition the state to `unpublished`. When the state transitions from `initial` to `unpublished`, **recurring shifts are created for the given week**. We wait until the last moment possible to do this so that modifications to recurring shifts are accounted for.\n\n**Boss**:\nWhen a schedule in the `initial` state reaches its `schedule.start - organization.shifts_assigned_days_before_start` time, Staffjoy automatically promotes it to `mobius-queue`. \n\n**Flex**:\nSchedules will remain in this state until they are moved.\n\n## unpublished\n\nShifts are constructed while the schedule is in the unpublished state. They can be created via the shifts api or by using Staffjoy's demand-based automated shift calculation.\n\nThere are 3 possible next states:\n\n* `chomp-queue` - Sends the schedule to Staffjoy's demand-based, automatic shift calculation service, Chomp. The schedule must have `demand`, `min_shift_length_hour`, and `max_shift_length_hour` set. When the system claims a job, the schedule state is set to `chomp-processing`. It will be returned to `unpublished` once shifts are calculated.\n* `mobius-queue` (Boss only) - Sends the schedule to Staffjoy's shift assignment system, Mobius. When the system claims a job, the schedule state is set to `mobius-processing`. The schedule will automatically be set to `published` after the calculation is complete.\n* `published` - Workers are not assigned to shifts, so this step typically happens only for **Flex** organizations when they click \"Publish Now\" in the UI.\n\n**Boss**: If a schedule is not been manually promoted to `mobius-queue`, it will be automatically transitioned once it reaches the time of `schedule.start - organization.shifts_assigned_days_before_start` time. The schedule is always set to `published` after calculation.\n\n**Flex**: Schedules will remain in this state until they are moved.\n\n## published\n\nWhen a schedule is transitioned to the `published` state, shifts in the role are automatically promoted to `published=true` if `schedule.start <= shift.start < schedule.stop`. All workers and admins receive an email notifying them that schedules are published. Workers may view and claim shifts in the My Schedules App.","category":"56fbf8a0587e43170081eb55","createdAt":"2016-03-30T16:02:50.386Z","excerpt":"","githubsync":"","hidden":false,"order":1,"type":"basic","__v":10,"api":{"settings":"","url":"","auth":"required","params":[],"results":{"codes":[{"name":"","status":200,"language":"json","code":"{}"},{"status":400,"language":"json","code":"{}","name":""}]}},"user":"561aed1a30e7490d0022d6ae","updates":[],"link_external":false,"sync_unique":"","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
Schedule State Machine
Staffjoy uses a state machine to control the automation of shift creation, assignment, and publication. Changing the state of a schedule coordinates actions for all shifts that start during the schedule. Formally, this is defined by schedule.start <= shift.start < schedule.stop
.
For reference, "chomp" refers to our internal engineering service that computes shifts from demand, and "mobius" refers to our internal engineering service that assigns workers to shifts.
initial
Schedules start in the initial
state. When a user begins planning schedules in the front-end, we transition the state to unpublished
. When the state transitions from initial
to unpublished
, recurring shifts are created for the given week. We wait until the last moment possible to do this so that modifications to recurring shifts are accounted for.
Boss:
When a schedule in the initial
state reaches its schedule.start - organization.shifts_assigned_days_before_start
time, Staffjoy automatically promotes it to mobius-queue
.
Flex:
Schedules will remain in this state until they are moved.
unpublished
Shifts are constructed while the schedule is in the unpublished state. They can be created via the shifts api or by using Staffjoy's demand-based automated shift calculation.
There are 3 possible next states:
chomp-queue
- Sends the schedule to Staffjoy's demand-based, automatic shift calculation service, Chomp. The schedule must havedemand
,min_shift_length_hour
, andmax_shift_length_hour
set. When the system claims a job, the schedule state is set tochomp-processing
. It will be returned tounpublished
once shifts are calculated.mobius-queue
(Boss only) - Sends the schedule to Staffjoy's shift assignment system, Mobius. When the system claims a job, the schedule state is set tomobius-processing
. The schedule will automatically be set topublished
after the calculation is complete.published
- Workers are not assigned to shifts, so this step typically happens only for Flex organizations when they click "Publish Now" in the UI.
Boss: If a schedule is not been manually promoted to mobius-queue
, it will be automatically transitioned once it reaches the time of schedule.start - organization.shifts_assigned_days_before_start
time. The schedule is always set to published
after calculation.
Flex: Schedules will remain in this state until they are moved.
published
When a schedule is transitioned to the published
state, shifts in the role are automatically promoted to published=true
if schedule.start <= shift.start < schedule.stop
. All workers and admins receive an email notifying them that schedules are published. Workers may view and claim shifts in the My Schedules App.
{"_id":"5717cee92948680e00addc8e","createdAt":"2016-04-20T18:48:09.666Z","editedParams":true,"link_external":false,"slug":"all-schedules","version":"56fa046648e69f0e00a7742f","api":{"examples":{"codes":[{"language":"curl","code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/schedules/"}]},"method":"get","params":[{"desc":"ID of the organization","default":"","type":"int","name":"organization_id","in":"path","_id":"5717cee92948680e00addc91","ref":"","required":true},{"ref":"","required":true,"desc":"ID of the location","default":"","type":"int","name":"location_id","in":"path","_id":"5717cee92948680e00addc90"},{"type":"int","name":"role_id","in":"path","_id":"5717cee92948680e00addc8f","ref":"","required":true,"desc":"ID of the role","default":""},{"type":"datetime","name":"start","in":"query","_id":"5717d3a2f2d4380e006f0279","ref":"","required":false,"desc":"Iso8601 datetime to search for schedules that start after this time","default":""},{"type":"datetime","name":"end","in":"query","_id":"5717d3a2f2d4380e006f0278","ref":"","required":false,"desc":"Iso8601 datetime to search for schedules that start before this time","default":""}],"results":{"codes":[{"name":"","status":200,"language":"json","code":"{\n \"data\": [\n {\n \"created_at\": \"2016-03-02T08:31:38\",\n \"stop\": \"2016-02-15T08:00:00\",\n \"role_id\": 656,\n \"min_shift_length_hour\": null,\n \"start\": \"2016-02-08T08:00:00\",\n \"state\": \"published\",\n \"chomp_end\": null,\n \"demand\": {\n \"monday\": [0,0,0,0,0,0,0,0,0,3,3,3,3,3,3,3,3,0,0,0,0,0,0,0],\n \"tuesday\": [0,0,0,0,0,0,0,0,0,3,3,3,3,3,3,3,3,0,0,0,0,0,0,0],\n \"friday\": [0,0,0,0,0,0,0,0,0,3,3,3,3,3,3,3,3,0,0,0,0,0,0,0],\n \"wednesday\": [0,0,0,0,0,0,0,0,0,3,3,3,3,3,3,3,3,0,0,0,0,0,0,0],\n \"thursday\": [0,0,0,0,0,0,0,0,0,3,3,3,3,3,3,3,3,0,0,0,0,0,0,0],\n \"sunday\": [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],\n \"saturday\": [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]\n },\n \"id\": 1550,\n \"last_update\": null,\n \"max_shift_length_hour\": null,\n \"chomp_start\": null\n },\n {\n \"created_at\": \"2016-03-02T08:31:38\",\n \"stop\": \"2016-02-22T08:00:00\",\n \"role_id\": 656,\n \"min_shift_length_hour\": null,\n \"start\": \"2016-02-15T08:00:00\",\n \"state\": \"published\",\n \"chomp_end\": null,\n \"demand\": null,\n \"id\": 1551,\n \"last_update\": null,\n \"max_shift_length_hour\": null,\n \"chomp_start\": null\n },\n {\n \"created_at\": \"2016-03-02T08:32:09\",\n \"stop\": \"2016-02-29T08:00:00\",\n \"role_id\": 656,\n \"min_shift_length_hour\": null,\n \"start\": \"2016-02-22T08:00:00\",\n \"state\": \"published\",\n \"chomp_end\": null,\n \"demand\": null,\n \"id\": 1574,\n \"last_update\": \"2016-03-02T20:50:18\",\n \"max_shift_length_hour\": null,\n \"chomp_start\": null\n },\n ]\n}"}]},"settings":"","url":"/organizations/:organization_id/locations/:location_id/roles/:role_id/schedules/","auth":"required"},"editedParams2":true,"githubsync":"","hidden":false,"link_url":"","order":2,"parentDoc":null,"sync_unique":"","body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Location Member\",\n \"body\": \"Managers and workers within the location can access this in addition to organization administrators.\"\n}\n[/block]\nNote that the start and stop times on a schedule are in UTC time and translate to midnight on the start week in the location's local timezone.","user":"561da5369ace800d00289ea3","category":"56fbf8a0587e43170081eb55","isReference":false,"title":"All Schedules","updates":[],"__v":1,"excerpt":"","project":"56f9fe2cf9102d0e00ca623e","type":"get","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
getAll Schedules
Path Params
Query Params
Permission Required: Location Member
Managers and workers within the location can access this in addition to organization administrators.
Note that the start and stop times on a schedule are in UTC time and translate to midnight on the start week in the location's local timezone.
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/schedules/
Result Format
{
"data": [
{
"created_at": "2016-03-02T08:31:38",
"stop": "2016-02-15T08:00:00",
"role_id": 656,
"min_shift_length_hour": null,
"start": "2016-02-08T08:00:00",
"state": "published",
"chomp_end": null,
"demand": {
"monday": [0,0,0,0,0,0,0,0,0,3,3,3,3,3,3,3,3,0,0,0,0,0,0,0],
"tuesday": [0,0,0,0,0,0,0,0,0,3,3,3,3,3,3,3,3,0,0,0,0,0,0,0],
"friday": [0,0,0,0,0,0,0,0,0,3,3,3,3,3,3,3,3,0,0,0,0,0,0,0],
"wednesday": [0,0,0,0,0,0,0,0,0,3,3,3,3,3,3,3,3,0,0,0,0,0,0,0],
"thursday": [0,0,0,0,0,0,0,0,0,3,3,3,3,3,3,3,3,0,0,0,0,0,0,0],
"sunday": [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
"saturday": [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
},
"id": 1550,
"last_update": null,
"max_shift_length_hour": null,
"chomp_start": null
},
{
"created_at": "2016-03-02T08:31:38",
"stop": "2016-02-22T08:00:00",
"role_id": 656,
"min_shift_length_hour": null,
"start": "2016-02-15T08:00:00",
"state": "published",
"chomp_end": null,
"demand": null,
"id": 1551,
"last_update": null,
"max_shift_length_hour": null,
"chomp_start": null
},
{
"created_at": "2016-03-02T08:32:09",
"stop": "2016-02-29T08:00:00",
"role_id": 656,
"min_shift_length_hour": null,
"start": "2016-02-22T08:00:00",
"state": "published",
"chomp_end": null,
"demand": null,
"id": 1574,
"last_update": "2016-03-02T20:50:18",
"max_shift_length_hour": null,
"chomp_start": null
},
]
}
{"_id":"5717d6dcf2d4380e006f0282","githubsync":"","link_external":false,"parentDoc":null,"createdAt":"2016-04-20T19:22:04.737Z","updates":[],"version":"56fa046648e69f0e00a7742f","editedParams":true,"project":"56f9fe2cf9102d0e00ca623e","link_url":"","order":3,"title":"Schedule","type":"get","user":"561da5369ace800d00289ea3","__v":0,"api":{"examples":{"codes":[{"language":"curl","code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/schedules/1551"}]},"method":"get","params":[{"required":true,"desc":"ID of the organization","default":"","type":"int","name":"organization_id","in":"path","_id":"5717d6dcf2d4380e006f0286","ref":""},{"default":"","type":"int","name":"location_id","in":"path","_id":"5717d6dcf2d4380e006f0285","ref":"","required":true,"desc":"ID of the location"},{"_id":"5717d6dcf2d4380e006f0284","ref":"","required":true,"desc":"ID of the role","default":"","type":"int","name":"role_id","in":"path"},{"in":"path","_id":"5717d6dcf2d4380e006f0283","ref":"","required":true,"desc":"ID of the schedule","default":"","type":"int","name":"schedule_id"}],"results":{"codes":[{"status":200,"language":"json","code":"{\n \"data\": {\n \"max_shift_length_hour\": null,\n \"stop\": \"2016-04-11T07:00:00\",\n \"demand\": null,\n \"role_id\": 656,\n \"id\": 1580,\n \"created_at\": \"2016-03-02T08:32:09\",\n \"last_update\": \"2016-03-31T22:17:53\",\n \"min_shift_length_hour\": null,\n \"start\": \"2016-04-04T07:00:00\",\n \"state\": \"published\",\n \"chomp_end\": null,\n \"chomp_start\": null\n },\n \"resources\": [\n \"preferences\",\n \"shifts\",\n \"timeclocks\",\n \"timeoffrequests\"\n ]\n}","name":""}]},"settings":"","url":"/organizations/:organization_id/locations/:location_id/roles/:role_id/schedules/:schedule_id","auth":"required"},"editedParams2":true,"excerpt":"","hidden":false,"isReference":false,"slug":"schedule","sync_unique":"","body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Location Member\",\n \"body\": \"Managers and workers within the location can access this in addition to organization administrators.\"\n}\n[/block]","category":"56fbf8a0587e43170081eb55","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
getSchedule
Path Params
Permission Required: Location Member
Managers and workers within the location can access this in addition to organization administrators.
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/schedules/1551
Result Format
{
"data": {
"max_shift_length_hour": null,
"stop": "2016-04-11T07:00:00",
"demand": null,
"role_id": 656,
"id": 1580,
"created_at": "2016-03-02T08:32:09",
"last_update": "2016-03-31T22:17:53",
"min_shift_length_hour": null,
"start": "2016-04-04T07:00:00",
"state": "published",
"chomp_end": null,
"chomp_start": null
},
"resources": [
"preferences",
"shifts",
"timeclocks",
"timeoffrequests"
]
}
{"_id":"5717d8b3d555880e00e118f4","sync_unique":"","api":{"results":{"codes":[{"status":200,"language":"json","code":"{\n \"demand\": {\n \"monday\": [0,0,0,0,0,0,0,0,0,3,4,5,5,5,4,3,3,2,0,0,0,0,0,0],\n \"tuesday\": [0,0,0,0,0,0,0,0,0,3,4,5,5,5,4,3,3,2,0,0,0,0,0,0],\n \"friday\": [0,0,0,0,0,0,0,0,0,3,4,5,5,5,4,3,3,2,0,0,0,0,0,0],\n \"wednesday\": [0,0,0,0,0,0,0,0,0,3,4,5,5,5,4,3,3,2,0,0,0,0,0,0],\n \"thursday\": [0,0,0,0,0,0,0,0,0,3,4,5,5,5,4,3,3,2,0,0,0,0,0,0],\n \"sunday\": [0,0,0,0,0,0,0,0,0,3,4,5,5,5,4,3,3,2,0,0,0,0,0,0],\n \"saturday\": [0,0,0,0,0,0,0,0,0,3,4,5,5,5,4,3,3,2,0,0,0,0,0,0]\n\t}\n}","name":""}]},"settings":"","url":"/organizations/:organization_id/locations/:location_id/roles/:role_id/schedules/:schedule_id","auth":"required","examples":{"codes":[{"code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/schedules/1551 -X PATCH -d 'demand={\"monday\":[0,0,0,0,0,0,0,0,0,3,4,5,5,5,4,3,3,2,0,0,0,0,0,0],\"tuesday\":[0,0,0,0,0,0,0,0,0,3,4,5,5,5,4,3,3,2,0,0,0,0,0,0],\"friday\":[0,0,0,0,0,0,0,0,0,3,4,5,5,5,4,3,3,2,0,0,0,0,0,0],\"wednesday\":[0,0,0,0,0,0,0,0,0,3,4,5,5,5,4,3,3,2,0,0,0,0,0,0],\"thursday\":[0,0,0,0,0,0,0,0,0,3,4,5,5,5,4,3,3,2,0,0,0,0,0,0],\"sunday\":[0,0,0,0,0,0,0,0,0,3,4,5,5,5,4,3,3,2,0,0,0,0,0,0],\"saturday\":[0,0,0,0,0,0,0,0,0,3,4,5,5,5,4,3,3,2,0,0,0,0,0,0]}'\n","language":"curl"}]},"method":"patch","params":[{"type":"int","name":"organization_id","in":"path","_id":"5717d8b3d555880e00e118fc","ref":"","required":true,"desc":"ID of the organization","default":""},{"required":true,"desc":"ID of the location","default":"","type":"int","name":"location_id","in":"path","_id":"5717d8b3d555880e00e118fb","ref":""},{"desc":"ID of the role","default":"","type":"int","name":"role_id","in":"path","_id":"5717d8b3d555880e00e118fa","ref":"","required":true},{"ref":"","required":true,"desc":"ID of the schedule","default":"","type":"int","name":"schedule_id","in":"path","_id":"5717d8b3d555880e00e118f9"},{"required":false,"type":"string","in":"body","_id":"5717d8b3d555880e00e118f8","default":"","desc":"A JSON string of hourly demand for each day of the week.","name":"demand","ref":""},{"desc":"The desired state of the schedule.","name":"state","ref":"","required":false,"type":"string","in":"body","_id":"5717d8b3d555880e00e118f7","default":""},{"default":"","type":"int","name":"min_shift_length_hour","in":"body","_id":"5717d8b3d555880e00e118f6","ref":"","required":false,"desc":"If shifts are being generated, this determines the minimum length (in hours) that a shift can be"},{"_id":"5717d8b3d555880e00e118f5","ref":"","required":false,"desc":"If shifts are being generated, this determines the maximum length (in hours) that a shift can be","default":"","type":"int","name":"max_shift_length_hour","in":"body"}]},"editedParams":true,"editedParams2":true,"excerpt":"","hidden":false,"parentDoc":null,"project":"56f9fe2cf9102d0e00ca623e","type":"patch","version":"56fa046648e69f0e00a7742f","category":"56fbf8a0587e43170081eb55","createdAt":"2016-04-20T19:29:55.401Z","slug":"modify-a-schedule","updates":[],"githubsync":"","link_url":"","user":"561da5369ace800d00289ea3","__v":0,"body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Location Manager\",\n \"body\": \"Managers are limited to their location. Organization administrators have access in all locations.\"\n}\n[/block]\nThe example on the side shows a Patch request with demand being set via cURL.\n\n### Calculate Shifts\nFrom the `unpublished` state, make a patch request to set the state to ```chomp-queue```. The following parameters must also be set:\n* min_shift_length_hour\n* max_shift_length_hour\n* demand\n\n### Assign Shifts\nFrom the `unpublished` state, make a patch request to set the state to ```mobius-queue```. Any unassigned shifts will be assigned to workers according to their rules.","isReference":false,"link_external":false,"order":4,"title":"Modify a Schedule","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
patchModify a Schedule
Path Params
Body Params
Permission Required: Location Manager
Managers are limited to their location. Organization administrators have access in all locations.
The example on the side shows a Patch request with demand being set via cURL.
Calculate Shifts
From the unpublished
state, make a patch request to set the state to chomp-queue
. The following parameters must also be set:
- min_shift_length_hour
- max_shift_length_hour
- demand
Assign Shifts
From the unpublished
state, make a patch request to set the state to mobius-queue
. Any unassigned shifts will be assigned to workers according to their rules.
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/schedules/1551 -X PATCH -d 'demand={"monday":[0,0,0,0,0,0,0,0,0,3,4,5,5,5,4,3,3,2,0,0,0,0,0,0],"tuesday":[0,0,0,0,0,0,0,0,0,3,4,5,5,5,4,3,3,2,0,0,0,0,0,0],"friday":[0,0,0,0,0,0,0,0,0,3,4,5,5,5,4,3,3,2,0,0,0,0,0,0],"wednesday":[0,0,0,0,0,0,0,0,0,3,4,5,5,5,4,3,3,2,0,0,0,0,0,0],"thursday":[0,0,0,0,0,0,0,0,0,3,4,5,5,5,4,3,3,2,0,0,0,0,0,0],"sunday":[0,0,0,0,0,0,0,0,0,3,4,5,5,5,4,3,3,2,0,0,0,0,0,0],"saturday":[0,0,0,0,0,0,0,0,0,3,4,5,5,5,4,3,3,2,0,0,0,0,0,0]}'
Result Format
{
"demand": {
"monday": [0,0,0,0,0,0,0,0,0,3,4,5,5,5,4,3,3,2,0,0,0,0,0,0],
"tuesday": [0,0,0,0,0,0,0,0,0,3,4,5,5,5,4,3,3,2,0,0,0,0,0,0],
"friday": [0,0,0,0,0,0,0,0,0,3,4,5,5,5,4,3,3,2,0,0,0,0,0,0],
"wednesday": [0,0,0,0,0,0,0,0,0,3,4,5,5,5,4,3,3,2,0,0,0,0,0,0],
"thursday": [0,0,0,0,0,0,0,0,0,3,4,5,5,5,4,3,3,2,0,0,0,0,0,0],
"sunday": [0,0,0,0,0,0,0,0,0,3,4,5,5,5,4,3,3,2,0,0,0,0,0,0],
"saturday": [0,0,0,0,0,0,0,0,0,3,4,5,5,5,4,3,3,2,0,0,0,0,0,0]
}
}
{"_id":"571e6f344a14580e00760190","slug":"schedule-shifts","api":{"auth":"required","examples":{"codes":[{"language":"curl","code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/schedules/1551/shifts/"}]},"method":"get","params":[{"required":true,"desc":"ID of the organization","default":"","type":"int","name":"organization_id","in":"path","_id":"5717d6dcf2d4380e006f0286","ref":""},{"desc":"ID of the location","default":"","type":"int","name":"location_id","in":"path","_id":"5717d6dcf2d4380e006f0285","ref":"","required":true},{"name":"role_id","in":"path","_id":"5717d6dcf2d4380e006f0284","ref":"","required":true,"desc":"ID of the role","default":"","type":"int"},{"default":"","type":"int","name":"schedule_id","in":"path","_id":"5717d6dcf2d4380e006f0283","ref":"","required":true,"desc":"ID of the schedule"},{"_id":"571e7016e2b7000e0091c346","ref":"","required":false,"desc":"Filter results by shifts that are published or unpublished.","default":"","type":"boolean","name":"filter_by_published","in":"query"},{"in":"query","_id":"571e7016e2b7000e0091c345","ref":"","required":false,"desc":"If true, will include a summary of the number of minutes each User is scheduled to work.","default":"","type":"boolean","name":"include_summary"},{"name":"claimable_by_user","in":"query","_id":"571e7016e2b7000e0091c344","ref":"","required":false,"desc":"Returns all shifts that a user can claim without violating any of the rules from their worker profile","default":"","type":"int"}],"results":{"codes":[{"name":"","code":"{\n \"data\": [\n {\n \"user_id\": 1,\n \"stop\": \"2016-02-16T01:00:00\",\n \"role_id\": 656,\n \"start\": \"2016-02-15T17:00:00\",\n \"published\": true,\n \"user_name\": \"Nikola Tesla\",\n \"id\": 5229\n },\n {\n \"user_id\": 458,\n \"stop\": \"2016-02-16T01:00:00\",\n \"role_id\": 656,\n \"start\": \"2016-02-15T17:00:00\",\n \"published\": true,\n \"user_name\": \"Leonhard Euler\",\n \"id\": 5241\n },\n ]\n}","language":"json","status":200}]},"settings":"","url":"/organizations/:organization_id/locations/:location_id/roles/:role_id/schedules/:schedule_id/shifts/"},"createdAt":"2016-04-25T19:25:40.029Z","editedParams":true,"hidden":false,"link_url":"","project":"56f9fe2cf9102d0e00ca623e","updates":[],"body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Location Member\",\n \"body\": \"Managers and workers within the location can access this in addition to organization administrators. When using claimable_by_user, workers can only see shifts in the future.\"\n}\n[/block]","isReference":false,"parentDoc":null,"sync_unique":"","user":"561da5369ace800d00289ea3","version":"56fa046648e69f0e00a7742f","__v":1,"category":"571e6eead8667f0e00a3c2dd","excerpt":"Returns all shifts that start during a specific schedule. This endpoint is cached and naturally faster than the ordinary shifts endpoint.","githubsync":"","type":"get","editedParams2":true,"link_external":false,"order":0,"title":"Schedule Shifts","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
getSchedule Shifts
Path Params
Query Params
Permission Required: Location Member
Managers and workers within the location can access this in addition to organization administrators. When using claimable_by_user, workers can only see shifts in the future.
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/schedules/1551/shifts/
Result Format
{
"data": [
{
"user_id": 1,
"stop": "2016-02-16T01:00:00",
"role_id": 656,
"start": "2016-02-15T17:00:00",
"published": true,
"user_name": "Nikola Tesla",
"id": 5229
},
{
"user_id": 458,
"stop": "2016-02-16T01:00:00",
"role_id": 656,
"start": "2016-02-15T17:00:00",
"published": true,
"user_name": "Leonhard Euler",
"id": 5241
},
]
}
{"_id":"571e851dd8667f0e00a3c311","api":{"results":{"codes":[{"code":"{\n \"data\": [\n {\n \"user_id\": 458,\n \"stop\": \"2016-02-15T21:56:33\",\n \"role_id\": 656,\n \"start\": \"2016-02-15T17:56:14\",\n \"id\": 743\n },\n {\n \"user_id\": 1,\n \"stop\": \"2016-02-17T02:02:18\",\n \"role_id\": 656,\n \"start\": \"2016-02-16T16:02:06\",\n \"id\": 825\n },\n {\n \"user_id\": 2,\n \"stop\": \"2016-02-17T04:18:31\",\n \"role_id\": 656,\n \"start\": \"2016-02-16T17:16:49\",\n \"id\": 826\n },\n ]\n}","language":"json","status":200,"name":""}]},"settings":"","url":"/organizations/:organization_id/locations/:location_id/roles/:role_id/schedules/:schedule_id/timeclocks/","auth":"required","examples":{"codes":[{"language":"curl","code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/schedules/1551/timeclocks/"}]},"method":"get","params":[{"in":"path","_id":"5717d6dcf2d4380e006f0286","ref":"","required":true,"desc":"ID of the organization","default":"","type":"int","name":"organization_id"},{"ref":"","required":true,"desc":"ID of the location","default":"","type":"int","name":"location_id","in":"path","_id":"5717d6dcf2d4380e006f0285"},{"required":true,"desc":"ID of the role","default":"","type":"int","name":"role_id","in":"path","_id":"5717d6dcf2d4380e006f0284","ref":""},{"default":"","type":"int","name":"schedule_id","in":"path","_id":"5717d6dcf2d4380e006f0283","ref":"","required":true,"desc":"ID of the schedule"},{"in":"query","_id":"571e8545cb4baa0e00d13897","ref":"","required":false,"desc":"Filter results by timeclocks related to a specific user","default":"","type":"int","name":"user_id"}]},"githubsync":"","hidden":false,"isReference":false,"order":1,"parentDoc":null,"sync_unique":"","type":"get","body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Location Manager\",\n \"body\": \"Managers are limited to their location. Organization administrators have access in all locations.\"\n}\n[/block]","category":"571e6eead8667f0e00a3c2dd","createdAt":"2016-04-25T20:59:09.870Z","editedParams2":true,"project":"56f9fe2cf9102d0e00ca623e","title":"Schedule Timeclocks","__v":1,"link_url":"","slug":"schedule-timeclocks","updates":[],"user":"561da5369ace800d00289ea3","editedParams":true,"link_external":false,"version":"56fa046648e69f0e00a7742f","excerpt":"Returns all timeclocks that were started during the schedule.","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
getSchedule Timeclocks
Path Params
Query Params
Permission Required: Location Manager
Managers are limited to their location. Organization administrators have access in all locations.
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/schedules/1551/timeclocks/
Result Format
{
"data": [
{
"user_id": 458,
"stop": "2016-02-15T21:56:33",
"role_id": 656,
"start": "2016-02-15T17:56:14",
"id": 743
},
{
"user_id": 1,
"stop": "2016-02-17T02:02:18",
"role_id": 656,
"start": "2016-02-16T16:02:06",
"id": 825
},
{
"user_id": 2,
"stop": "2016-02-17T04:18:31",
"role_id": 656,
"start": "2016-02-16T17:16:49",
"id": 826
},
]
}
{"_id":"571e85ad4a14580e007601da","project":"56f9fe2cf9102d0e00ca623e","api":{"method":"get","params":[{"desc":"ID of the organization","default":"","type":"int","name":"organization_id","in":"path","_id":"5717d6dcf2d4380e006f0286","ref":"","required":true},{"ref":"","required":true,"desc":"ID of the location","default":"","type":"int","name":"location_id","in":"path","_id":"5717d6dcf2d4380e006f0285"},{"type":"int","name":"role_id","in":"path","_id":"5717d6dcf2d4380e006f0284","ref":"","required":true,"desc":"ID of the role","default":""},{"type":"int","name":"schedule_id","in":"path","_id":"5717d6dcf2d4380e006f0283","ref":"","required":true,"desc":"ID of the schedule","default":""},{"required":false,"type":"int","in":"query","_id":"571e8545cb4baa0e00d13897","default":"","desc":"Filter results by time off requests related to a specific user","name":"user_id","ref":""}],"results":{"codes":[{"status":200,"name":"","code":"{\n \"data\": [\n {\n \"start\": \"2016-06-15T07:00:00\",\n \"state\": null,\n \"user_id\": 2,\n \"approver_user_id\": 0,\n \"minutes_paid\": 0,\n \"stop\": \"2016-06-16T07:00:00\",\n \"id\": 371,\n \"role_id\": 656\n }\n ]\n}","language":"json"}]},"settings":"","url":"/organizations/:organization_id/locations/:location_id/roles/:role_id/schedules/:schedule_id/timeoffrequests/","auth":"required","examples":{"codes":[{"code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/schedules/1551/timeoffrequests/","language":"curl"}]}},"createdAt":"2016-04-25T21:01:33.022Z","editedParams":true,"githubsync":"","type":"get","body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Location Manager\",\n \"body\": \"Managers are limited to their location. Organization administrators have access in all locations.\"\n}\n[/block]","hidden":false,"link_external":false,"title":"Schedule Time Off Requests","updates":[],"user":"561da5369ace800d00289ea3","__v":0,"editedParams2":true,"link_url":"","order":2,"slug":"schedule-time-off-requests","sync_unique":"","version":"56fa046648e69f0e00a7742f","category":"571e6eead8667f0e00a3c2dd","excerpt":"Returns all time off requests that occur during the schedule.","isReference":false,"parentDoc":null,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
getSchedule Time Off Requests
Path Params
Query Params
Permission Required: Location Manager
Managers are limited to their location. Organization administrators have access in all locations.
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/schedules/1551/timeoffrequests/
Result Format
{
"data": [
{
"start": "2016-06-15T07:00:00",
"state": null,
"user_id": 2,
"approver_user_id": 0,
"minutes_paid": 0,
"stop": "2016-06-16T07:00:00",
"id": 371,
"role_id": 656
}
]
}
{"_id":"571e8c30cb4baa0e00d138ac","slug":"all-preferences","updates":[],"__v":1,"category":"571e8c1eebc88a0e008d4fc4","createdAt":"2016-04-25T21:29:20.946Z","hidden":false,"order":0,"body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Location Manager\",\n \"body\": \"Managers are limited to their location. Organization administrators have access in all locations.\"\n}\n[/block]","link_external":false,"parentDoc":null,"project":"56f9fe2cf9102d0e00ca623e","type":"get","api":{"auth":"required","examples":{"codes":[{"code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/schedules/1587/preferences/","language":"curl"}]},"method":"get","params":[{"_id":"5717d6dcf2d4380e006f0286","ref":"","required":true,"desc":"ID of the organization","default":"","type":"int","name":"organization_id","in":"path"},{"_id":"5717d6dcf2d4380e006f0285","ref":"","required":true,"desc":"ID of the location","default":"","type":"int","name":"location_id","in":"path"},{"in":"path","_id":"5717d6dcf2d4380e006f0284","ref":"","required":true,"desc":"ID of the role","default":"","type":"int","name":"role_id"},{"name":"schedule_id","in":"path","_id":"5717d6dcf2d4380e006f0283","ref":"","required":true,"desc":"ID of the schedule","default":"","type":"int"}],"results":{"codes":[{"status":200,"language":"json","code":"{\n \"data\": [\n {\n \"created_at\": \"2016-04-22T00:30:58\",\n \"schedule_id\": 1587,\n \"user_id\": 1,\n \"preference\": {\n \"monday\": [0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0],\n \"tuesday\": [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],\n \"friday\": [0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0],\n \"wednesday\": [0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],\n \"thursday\": [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],\n \"sunday\": [0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0],\n \"saturday\": [0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0]\n },\n \"last_update\": \"2016-04-22T00:31:25\"\n }\n ]\n}","name":""}]},"settings":"","url":"/organizations/:organization_id/locations/:location_id/roles/:role_id/schedules/:schedule_id/preferences/"},"editedParams":true,"editedParams2":true,"link_url":"","sync_unique":"","title":"All Preferences","excerpt":"Returns all shifts that start during a specific schedule. This endpoint is cached and naturally faster than the ordinary shifts endpoint.","githubsync":"","isReference":false,"user":"561da5369ace800d00289ea3","version":"56fa046648e69f0e00a7742f","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
getAll Preferences
Path Params
Permission Required: Location Manager
Managers are limited to their location. Organization administrators have access in all locations.
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/schedules/1587/preferences/
Result Format
{
"data": [
{
"created_at": "2016-04-22T00:30:58",
"schedule_id": 1587,
"user_id": 1,
"preference": {
"monday": [0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0],
"tuesday": [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
"friday": [0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0],
"wednesday": [0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
"thursday": [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
"sunday": [0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0],
"saturday": [0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0]
},
"last_update": "2016-04-22T00:31:25"
}
]
}
{"_id":"571e8e07cb4baa0e00d138af","link_external":false,"editedParams":true,"excerpt":"","hidden":false,"isReference":false,"__v":1,"body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Location Manager or Individual\",\n \"body\": \"Managers are limited to their location. Organization administrators have access in all locations. Workers are able to create their own data.\"\n}\n[/block]","category":"571e8c1eebc88a0e008d4fc4","version":"56fa046648e69f0e00a7742f","link_url":"","order":1,"slug":"create-a-preference","type":"post","editedParams2":true,"githubsync":"","user":"561da5369ace800d00289ea3","sync_unique":"","title":"Create Preferences","updates":[],"api":{"auth":"required","examples":{"codes":[{"code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/schedules/1587 -X POST -d 'preference={\"monday\":[0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0],\"tuesday\":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],\"friday\":[0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0],\"wednesday\":[0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],\"thursday\":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],\"sunday\":[0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0],\"saturday\":[0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0]}' -d 'user_id=2'","language":"curl"}]},"method":"post","params":[{"type":"int","name":"organization_id","in":"path","_id":"5719252fb69de41700478477","ref":"","required":true,"desc":"ID of the organization","default":""},{"required":true,"desc":"ID of the location","default":"","type":"int","name":"location_id","in":"path","_id":"5719252fb69de41700478476","ref":""},{"default":"","type":"int","name":"role_id","in":"path","_id":"5719252fb69de41700478475","ref":"","required":true,"desc":"ID of the role"},{"in":"body","_id":"571e8e64ac2a080e0014c4a1","ref":"","required":true,"desc":"ID of the schedule","default":"","type":"int","name":"schedule_id"},{"name":"preference","in":"body","_id":"571e8e64ac2a080e0014c4a0","ref":"","required":true,"desc":"Needs a serialized JSON structure of the same format used for setting demand, but only with binary data. 1 for preferred, 0 for not preferred.","default":"","type":"string"},{"default":"","type":"int","name":"user_id","in":"body","_id":"571e8e64ac2a080e0014c49f","ref":"","required":true,"desc":"ID of the user"}],"results":{"codes":[{"status":201,"language":"json","code":"{\n \"created_at\": \"2016-04-25T21:42:41\",\n \"schedule_id\": 1589,\n \"user_id\": 2,\n \"preference\": {\n \"monday\": [0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0],\n \"tuesday\": [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],\n \"friday\": [0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0],\n \"wednesday\": [0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],\n \"thursday\": [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],\n \"sunday\": [0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0],\n \"saturday\": [0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0]\n },\n \"last_update\": null\n}","name":""}]},"settings":"","url":"/organizations/:organization_id/locations/:location_id/roles/:role_id/shifts/"},"createdAt":"2016-04-25T21:37:11.537Z","parentDoc":null,"project":"56f9fe2cf9102d0e00ca623e","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
postCreate Preferences
Path Params
Body Params
Permission Required: Location Manager or Individual
Managers are limited to their location. Organization administrators have access in all locations. Workers are able to create their own data.
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/schedules/1587 -X POST -d 'preference={"monday":[0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0],"tuesday":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"friday":[0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0],"wednesday":[0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],"thursday":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"sunday":[0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0],"saturday":[0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0]}' -d 'user_id=2'
Result Format
{
"created_at": "2016-04-25T21:42:41",
"schedule_id": 1589,
"user_id": 2,
"preference": {
"monday": [0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0],
"tuesday": [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
"friday": [0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0],
"wednesday": [0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
"thursday": [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
"sunday": [0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0],
"saturday": [0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0]
},
"last_update": null
}
{"_id":"571e8ffdebc88a0e008d4fc8","excerpt":"Returns all shifts that start during a specific schedule. This endpoint is cached and naturally faster than the ordinary shifts endpoint.","hidden":false,"parentDoc":null,"sync_unique":"","api":{"method":"get","params":[{"desc":"ID of the organization","default":"","type":"int","name":"organization_id","in":"path","_id":"5717d6dcf2d4380e006f0286","ref":"","required":true},{"ref":"","required":true,"desc":"ID of the location","default":"","type":"int","name":"location_id","in":"path","_id":"5717d6dcf2d4380e006f0285"},{"type":"int","name":"role_id","in":"path","_id":"5717d6dcf2d4380e006f0284","ref":"","required":true,"desc":"ID of the role","default":""},{"type":"int","name":"schedule_id","in":"path","_id":"5717d6dcf2d4380e006f0283","ref":"","required":true,"desc":"ID of the schedule","default":""},{"required":true,"desc":"ID of the user","default":"","type":"int","name":"user_id","in":"path","_id":"571e900dcb4baa0e00d138b2","ref":""}],"results":{"codes":[{"status":200,"language":"json","code":"{\n \"data\": [\n {\n \"created_at\": \"2016-04-22T00:30:58\",\n \"schedule_id\": 1587,\n \"user_id\": 1,\n \"preference\": {\n \"monday\": [0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0],\n \"tuesday\": [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],\n \"friday\": [0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0],\n \"wednesday\": [0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],\n \"thursday\": [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],\n \"sunday\": [0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0],\n \"saturday\": [0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0]\n },\n \"last_update\": \"2016-04-22T00:31:25\"\n }\n ]\n}","name":""}]},"settings":"","url":"/organizations/:organization_id/locations/:location_id/roles/:role_id/schedules/:schedule_id/preferences/:user_id","auth":"required","examples":{"codes":[{"code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/schedules/1587/preferences/2","language":"curl"}]}},"createdAt":"2016-04-25T21:45:33.025Z","editedParams2":true,"type":"get","updates":[],"version":"56fa046648e69f0e00a7742f","link_external":false,"project":"56f9fe2cf9102d0e00ca623e","user":"561da5369ace800d00289ea3","__v":1,"body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Location Manager or Individual\",\n \"body\": \"Managers are limited to their location. Organization administrators have access in all locations. Workers are able to access their own data.\"\n}\n[/block]","editedParams":true,"githubsync":"","category":"571e8c1eebc88a0e008d4fc4","link_url":"","slug":"preferences","isReference":false,"order":2,"title":"Preferences","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
getPreferences
Path Params
Permission Required: Location Manager or Individual
Managers are limited to their location. Organization administrators have access in all locations. Workers are able to access their own data.
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/schedules/1587/preferences/2
Result Format
{
"data": [
{
"created_at": "2016-04-22T00:30:58",
"schedule_id": 1587,
"user_id": 1,
"preference": {
"monday": [0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0],
"tuesday": [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
"friday": [0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0],
"wednesday": [0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
"thursday": [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
"sunday": [0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0],
"saturday": [0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0]
},
"last_update": "2016-04-22T00:31:25"
}
]
}
{"_id":"571e90f1cb4baa0e00d138b3","version":"56fa046648e69f0e00a7742f","githubsync":"","hidden":false,"isReference":false,"link_external":false,"createdAt":"2016-04-25T21:49:37.935Z","parentDoc":null,"title":"Modify Preferences","updates":[],"sync_unique":"","user":"561da5369ace800d00289ea3","editedParams2":true,"excerpt":"","link_url":"","project":"56f9fe2cf9102d0e00ca623e","slug":"modify-preferences","order":3,"type":"patch","__v":1,"api":{"params":[{"name":"organization_id","in":"path","_id":"57192566e967cb1700d078f5","ref":"","required":true,"desc":"ID of the organization","default":"","type":"int"},{"desc":"ID of the location","default":"","type":"int","name":"location_id","in":"path","_id":"57192566e967cb1700d078f4","ref":"","required":true},{"ref":"","required":true,"desc":"ID of the role","default":"","type":"int","name":"role_id","in":"path","_id":"57192566e967cb1700d078f3"},{"type":"int","name":"schedule_id","in":"path","_id":"57192566e967cb1700d078f2","ref":"","required":true,"desc":"ID of the schedule","default":""},{"required":true,"desc":"ID of the user","default":"","type":"int","name":"user_id","in":"path","_id":"571e9186ac2a080e0014c4ab","ref":""},{"default":"","type":"string","name":"preference","in":"body","_id":"571e9186ac2a080e0014c4aa","ref":"","required":false,"desc":"Needs a serialized JSON structure of the same format used for setting demand, but only with binary data. 1 for preferred, 0 for not preferred."}],"results":{"codes":[{"code":"{\n \"preference\": {\n \"monday\": [0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0],\n \"tuesday\": [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],\n \"friday\": [0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0],\n \"wednesday\": [0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],\n \"thursday\": [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],\n \"sunday\": [0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0],\n \"saturday\": [0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0]\n },\n}","language":"json","status":200,"name":""}]},"settings":"","url":"/organizations/:organization_id/locations/:location_id/roles/:role_id/schedules/:schedule_id/preferences/:user_id","auth":"required","examples":{"codes":[{"code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/schedules/1587/2 -X PATCH -d 'preference={\"monday\":[0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0],\"tuesday\":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],\"friday\":[0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0],\"wednesday\":[0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],\"thursday\":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],\"sunday\":[0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0],\"saturday\":[0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0]}'","language":"curl"}]},"method":"patch"},"body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Location Manager or Individual\",\n \"body\": \"Managers are limited to their location. Organization administrators have access in all locations. Workers are able to modify their own data.\"\n}\n[/block]","category":"571e8c1eebc88a0e008d4fc4","editedParams":true,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
patchModify Preferences
Path Params
Body Params
Permission Required: Location Manager or Individual
Managers are limited to their location. Organization administrators have access in all locations. Workers are able to modify their own data.
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/schedules/1587/2 -X PATCH -d 'preference={"monday":[0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0],"tuesday":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"friday":[0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0],"wednesday":[0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],"thursday":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"sunday":[0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0],"saturday":[0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0]}'
Result Format
{
"preference": {
"monday": [0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0],
"tuesday": [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
"friday": [0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0],
"wednesday": [0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
"thursday": [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
"sunday": [0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0],
"saturday": [0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0]
},
}
{"_id":"571e909f4a14580e007601f1","__v":1,"body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Location Manager\",\n \"body\": \"Managers are limited to their location. Organization administrators have access in all locations.\"\n}\n[/block]","category":"571e8c1eebc88a0e008d4fc4","editedParams":true,"githubsync":"","parentDoc":null,"type":"delete","version":"56fa046648e69f0e00a7742f","excerpt":"","isReference":false,"slug":"delete-preferences","sync_unique":"","title":"Delete Preferences","user":"561da5369ace800d00289ea3","api":{"auth":"required","examples":{"codes":[{"language":"curl","code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/schedules/1587/preferences/2 -X DELETE"}]},"method":"delete","params":[{"ref":"","required":true,"desc":"ID of the organization","default":"","type":"int","name":"organization_id","in":"path","_id":"571925866346850e00833ffd"},{"required":true,"desc":"ID of the location","default":"","type":"int","name":"location_id","in":"path","_id":"571925866346850e00833ffc","ref":""},{"default":"","type":"int","name":"role_id","in":"path","_id":"571925866346850e00833ffb","ref":"","required":true,"desc":"ID of the role"},{"in":"body","_id":"571925866346850e00833ffa","ref":"","required":true,"desc":"ID of the shift","default":"","type":"int","name":"shift_id"},{"ref":"","required":true,"desc":"ID of the user","default":"","type":"int","name":"user_id","in":"path","_id":"571e90dde2b7000e0091c393"}],"results":{"codes":[{"name":"","code":"{}","language":"json","status":204}]},"settings":"","url":"/organizations/:organization_id/locations/:location_id/roles/:role_id/schedules/:schedule_id/preferences/:user_id"},"createdAt":"2016-04-25T21:48:15.080Z","editedParams2":true,"link_external":false,"project":"56f9fe2cf9102d0e00ca623e","updates":[],"hidden":false,"link_url":"","order":4,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
deleteDelete Preferences
Path Params
Body Params
Permission Required: Location Manager
Managers are limited to their location. Organization administrators have access in all locations.
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/schedules/1587/preferences/2 -X DELETE
Result Format
{"_id":"57192454b69de41700478470","api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","url":"","auth":"required","params":[]},"body":"A shift represents when someone is scheduled to work.\n\n## Attributes:\n\n* id (int) - A unique identifier\n* role_id (int) - Maps the relationship between a shift and its role\n* user_id (int) - The user who the shift is assigned to\n* start (Iso8601 datetime) - Determines when the shift starts, in UTC\n* stop (Iso8601 datetime) - Determines when the shift ends, in UTC\n* published (boolean) - Determines whether workers can see the shift in My Schedules\n* description (string) - A string that allows additional custom information to be included with the shift\n\n## Notes:\n\n* The start and end times are stored in UTC in the Staffjoy database, and all queries to search the database need datetime values to be in UTC as well.\n* Shifts are allowed to be up to 23 hours long. \n* Unassigned shifts have a user_id of 0.\n* A user is not allowed to be assigned to a shift if it overlaps with another shift he is assigned to\n* Shifts are specific to roles, and only workers in that role can be assigned to them","order":0,"__v":2,"githubsync":"","isReference":false,"link_url":"","type":"basic","category":"56fbf89d4c3cea190015da0d","excerpt":"","hidden":false,"parentDoc":null,"sync_unique":"","version":"56fa046648e69f0e00a7742f","createdAt":"2016-04-21T19:04:52.112Z","link_external":false,"project":"56f9fe2cf9102d0e00ca623e","slug":"shifts-overview","title":"Shifts Overview","updates":[],"user":"561da5369ace800d00289ea3","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
Shifts Overview
A shift represents when someone is scheduled to work.
Attributes:
- id (int) - A unique identifier
- role_id (int) - Maps the relationship between a shift and its role
- user_id (int) - The user who the shift is assigned to
- start (Iso8601 datetime) - Determines when the shift starts, in UTC
- stop (Iso8601 datetime) - Determines when the shift ends, in UTC
- published (boolean) - Determines whether workers can see the shift in My Schedules
- description (string) - A string that allows additional custom information to be included with the shift
Notes:
- The start and end times are stored in UTC in the Staffjoy database, and all queries to search the database need datetime values to be in UTC as well.
- Shifts are allowed to be up to 23 hours long.
- Unassigned shifts have a user_id of 0.
- A user is not allowed to be assigned to a shift if it overlaps with another shift he is assigned to
- Shifts are specific to roles, and only workers in that role can be assigned to them
{"_id":"571924626346850e00833ff3","link_url":"","sync_unique":"","version":"56fa046648e69f0e00a7742f","__v":2,"api":{"auth":"required","examples":{"codes":[{"code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/shifts/ -d \"start=2016-04-05T08:00:00\" -d \"end=2016-04-15T08:00:00\"","language":"curl"}]},"method":"get","params":[{"desc":"ID of the organization","default":"","type":"int","name":"organization_id","in":"path","_id":"5719251cac1e2e0e001833bc","ref":"","required":true},{"ref":"","required":true,"desc":"ID of the location","default":"","type":"int","name":"location_id","in":"path","_id":"5719251cac1e2e0e001833bb"},{"required":true,"desc":"ID of the role","default":"","type":"int","name":"role_id","in":"path","_id":"5719251cac1e2e0e001833ba","ref":""},{"desc":"Search for shifts that start after the given time","default":"","type":"datetime","name":"start","in":"query","_id":"57193cd8e967cb1700d0797d","ref":"","required":true},{"name":"end","in":"query","_id":"57193cd8e967cb1700d0797c","ref":"","required":true,"desc":"Search for shifts that start before the given time","default":"","type":"datetime"},{"desc":"Filter results by shifts that are assigned to the given User ID. Use 0 to search for unassigned shifts.","default":"","type":"int","name":"user_id","in":"query","_id":"57193cd8e967cb1700d0797b","ref":"","required":false},{"name":"filter_by_published","in":"query","_id":"57193cd8e967cb1700d0797a","ref":"","required":false,"desc":"Filter results by shifts that are published or unpublished.","default":"","type":"boolean"},{"default":"","type":"boolean","name":"include_summary","in":"query","_id":"57193cd8e967cb1700d07979","ref":"","required":false,"desc":"If true, will include a summary of the number of minutes each User is scheduled to work"},{"_id":"57193cd8e967cb1700d07978","ref":"","required":false,"desc":"If true, the response will be a CSV file of the shifts","default":"","type":"boolean","name":"csv_export","in":"query"}],"results":{"codes":[{"code":"{\n \"data\": [\n {\n \"user_id\": 706,\n \"stop\": \"2016-04-06T00:00:00\",\n \"role_id\": 656,\n \"start\": \"2016-04-05T16:00:00\",\n \"published\": true,\n \"user_name\": \"Rosalind Franklin\",\n \"id\": 41674\n },\n {\n \"user_id\": 2,\n \"stop\": \"2016-04-11T21:30:00\",\n \"role_id\": 656,\n \"start\": \"2016-04-11T15:30:00\",\n \"published\": false,\n \"user_name\": \"Nikola Tesla\",\n \"id\": 42194\n }\n ]\n}","language":"json","status":200,"name":""}]},"settings":"","url":"/organizations/:organization_id/locations/:location_id/roles/:role_id/shifts/"},"editedParams":true,"order":1,"parentDoc":null,"project":"56f9fe2cf9102d0e00ca623e","title":"All Shifts","body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Location Member\",\n \"body\": \"Managers and workers within the location can access this in addition to organization administrators.\"\n}\n[/block]","hidden":false,"isReference":false,"type":"get","updates":[],"category":"56fbf89d4c3cea190015da0d","createdAt":"2016-04-21T19:05:06.321Z","editedParams2":true,"excerpt":"","githubsync":"","link_external":false,"slug":"all-shifts","user":"561da5369ace800d00289ea3","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
getAll Shifts
Path Params
Query Params
Permission Required: Location Member
Managers and workers within the location can access this in addition to organization administrators.
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/shifts/ -d "start=2016-04-05T08:00:00" -d "end=2016-04-15T08:00:00"
Result Format
{
"data": [
{
"user_id": 706,
"stop": "2016-04-06T00:00:00",
"role_id": 656,
"start": "2016-04-05T16:00:00",
"published": true,
"user_name": "Rosalind Franklin",
"id": 41674
},
{
"user_id": 2,
"stop": "2016-04-11T21:30:00",
"role_id": 656,
"start": "2016-04-11T15:30:00",
"published": false,
"user_name": "Nikola Tesla",
"id": 42194
}
]
}
{"_id":"57192469e967cb1700d078e5","api":{"results":{"codes":[{"name":"","code":"{\n \"user_id\": 0,\n \"stop\": \"2016-04-21T04:00:00\",\n \"role_id\": 656,\n \"start\": \"2016-04-21T00:00:00\",\n \"published\": false,\n \"user_name\": null,\n \"id\": 42193\n}","language":"json","status":201}]},"settings":"","url":"/organizations/:organization_id/locations/:location_id/roles/:role_id/shifts/","auth":"required","examples":{"codes":[{"language":"curl","code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/shifts/ -X POST -d \"start=2016-04-21T08:00:00-08:00\" -d \"stop=2016-04-21T12:00:00-08:00\""}]},"method":"post","params":[{"_id":"5719252fb69de41700478477","ref":"","required":true,"desc":"ID of the organization","default":"","type":"int","name":"organization_id","in":"path"},{"_id":"5719252fb69de41700478476","ref":"","required":true,"desc":"ID of the location","default":"","type":"int","name":"location_id","in":"path"},{"_id":"5719252fb69de41700478475","ref":"","required":true,"desc":"ID of the role","default":"","type":"int","name":"role_id","in":"path"},{"_id":"57192a28ac1e2e0e001833d6","ref":"","required":true,"desc":"When the shift starts, an Iso8601 datetime in UTC time","default":"","type":"datetime","name":"start","in":"body"},{"in":"body","_id":"57192a28ac1e2e0e001833d5","ref":"","required":true,"desc":"When the shift ends, an Iso8601 datetime in UTC time","default":"","type":"datetime","name":"stop"},{"name":"user_id","in":"body","_id":"57192a28ac1e2e0e001833d4","ref":"","required":false,"desc":"Assigns the shift to a specific user, if set to 0 or left blank, will be left unassigned","default":"","type":"int"},{"default":"","type":"boolean","name":"published","in":"body","_id":"57192a28ac1e2e0e001833d3","ref":"","required":false,"desc":"Determines whether workers can see the shift in My Schedules. Defaults to false"},{"_id":"575f11f141c8ba0e00259c1c","ref":"","required":false,"desc":"A custom description of the shift","default":"","type":"string","name":"description","in":"body"}]},"editedParams":true,"githubsync":"","parentDoc":null,"body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Location Manager\",\n \"body\": \"Managers are limited to their location. Organization administrators have access in all locations.\"\n}\n[/block]\n\n[block:callout]\n{\n \"type\": \"warning\",\n \"title\": \"Be Careful About Timezones\",\n \"body\": \"Start and stop times are stored in Staffjoy databases in UTC time. When creating a shift, it is best to be specific.\\n\\nIn the example on the side, the `start` gives a time of `08:00:00-08:00`, which would be 8 AM with a local timezone offset of 8 hours. The response shows that in UTC this same time is `00:00:00+00:00`. If the `start` param only sent `08:00:00`, this would be interpreted as UTC, and then the shift would actually start at `16:00:00` in the local timezone!\\n\\nTo avoid problems, follow these tips:\\n* Use a library for timezone conversions such as [pytz](http://pytz.sourceforge.net/). The adjustment needed to convert between a local time and UTC changes depending on Daylight Savings Time.\\n* Never use naive datetimes. It's best to convert everything to UTC before sending to Staffjoy, but it is ok to send the timezone offset too.\"\n}\n[/block]","editedParams2":true,"excerpt":"","hidden":false,"type":"post","updates":[],"category":"56fbf89d4c3cea190015da0d","createdAt":"2016-04-21T19:05:13.402Z","isReference":false,"order":2,"project":"56f9fe2cf9102d0e00ca623e","__v":4,"link_external":false,"link_url":"","slug":"create-a-shift","sync_unique":"","title":"Create a Shift","user":"561da5369ace800d00289ea3","version":"56fa046648e69f0e00a7742f","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
postCreate a Shift
Path Params
Body Params
Permission Required: Location Manager
Managers are limited to their location. Organization administrators have access in all locations.
Be Careful About Timezones
Start and stop times are stored in Staffjoy databases in UTC time. When creating a shift, it is best to be specific.
In the example on the side, the start
gives a time of 08:00:00-08:00
, which would be 8 AM with a local timezone offset of 8 hours. The response shows that in UTC this same time is 00:00:00+00:00
. If the start
param only sent 08:00:00
, this would be interpreted as UTC, and then the shift would actually start at 16:00:00
in the local timezone!
To avoid problems, follow these tips:
- Use a library for timezone conversions such as pytz. The adjustment needed to convert between a local time and UTC changes depending on Daylight Savings Time.
- Never use naive datetimes. It's best to convert everything to UTC before sending to Staffjoy, but it is ok to send the timezone offset too.
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/shifts/ -X POST -d "start=2016-04-21T08:00:00-08:00" -d "stop=2016-04-21T12:00:00-08:00"
Result Format
{
"user_id": 0,
"stop": "2016-04-21T04:00:00",
"role_id": 656,
"start": "2016-04-21T00:00:00",
"published": false,
"user_name": null,
"id": 42193
}
{"_id":"5748dc805a77a71700965627","hidden":false,"updates":[],"body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Location Member\",\n \"body\": \"Managers and workers within the location can access this in addition to organization administrators.\"\n}\n[/block]","editedParams":true,"link_url":"","parentDoc":null,"project":"56f9fe2cf9102d0e00ca623e","version":"56fa046648e69f0e00a7742f","title":"Shift","user":"561da5369ace800d00289ea3","__v":0,"api":{"settings":"","url":"/organizations/:organization_id/locations/:location_id/roles/:role_id/shifts/:shift_id","auth":"required","examples":{"codes":[{"language":"curl","code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/shifts/830"}]},"method":"get","params":[{"name":"organization_id","in":"path","_id":"5719254c6346850e00833ff9","ref":"","required":true,"desc":"ID of the organization","default":"","type":"int"},{"desc":"ID of the location","default":"","type":"int","name":"location_id","in":"path","_id":"5719254c6346850e00833ff8","ref":"","required":true},{"ref":"","required":true,"desc":"ID of the role","default":"","type":"int","name":"role_id","in":"path","_id":"5719254c6346850e00833ff7"},{"type":"int","name":"shift_id","in":"path","_id":"5719254c6346850e00833ff6","ref":"","required":true,"desc":"ID of the recurring shift","default":""}],"results":{"codes":[{"status":200,"language":"json","code":"{\n \"data\": {\n \"user_id\": 706,\n \"stop\": \"2016-04-06T00:00:00\",\n \"role_id\": 656,\n \"start\": \"2016-04-05T16:00:00\",\n \"published\": true,\n \"user_name\": \"Rosalind Franklin\",\n \"id\": 41674\n },\n \"resources\": [\n \"users\"\n ]\n}","name":""}]}},"editedParams2":true,"link_external":false,"slug":"shift-1","sync_unique":"","order":3,"type":"get","category":"56fbf89d4c3cea190015da0d","createdAt":"2016-05-27T23:47:12.038Z","excerpt":"","githubsync":"","isReference":false,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
getShift
Path Params
Permission Required: Location Member
Managers and workers within the location can access this in addition to organization administrators.
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/shifts/830
Result Format
{
"data": {
"user_id": 706,
"stop": "2016-04-06T00:00:00",
"role_id": 656,
"start": "2016-04-05T16:00:00",
"published": true,
"user_name": "Rosalind Franklin",
"id": 41674
},
"resources": [
"users"
]
}
{"_id":"57192484ac1e2e0e001833b5","__v":3,"createdAt":"2016-04-21T19:05:40.934Z","order":4,"project":"56f9fe2cf9102d0e00ca623e","updates":[],"category":"56fbf89d4c3cea190015da0d","githubsync":"","hidden":false,"link_external":false,"sync_unique":"","editedParams":true,"editedParams2":true,"link_url":"","parentDoc":null,"title":"Modify a Shift","version":"56fa046648e69f0e00a7742f","api":{"auth":"required","examples":{"codes":[{"language":"curl","code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/shifts/5241 -X PATCH -d \"user_id=2\""}]},"method":"patch","params":[{"in":"path","_id":"57192566e967cb1700d078f5","ref":"","required":true,"desc":"ID of the organization","default":"","type":"int","name":"organization_id"},{"name":"location_id","in":"path","_id":"57192566e967cb1700d078f4","ref":"","required":true,"desc":"ID of the location","default":"","type":"int"},{"default":"","type":"int","name":"role_id","in":"path","_id":"57192566e967cb1700d078f3","ref":"","required":true,"desc":"ID of the role"},{"in":"path","_id":"57192566e967cb1700d078f2","ref":"","required":true,"desc":"ID of the shift","default":"","type":"int","name":"shift_id"},{"ref":"","required":false,"desc":"When the shift starts, an Iso8601 datetime in UTC time","default":"","type":"datetime","name":"start","in":"body","_id":"571928e2e967cb1700d07909"},{"type":"datetime","name":"stop","in":"body","_id":"571928e2e967cb1700d07908","ref":"","required":false,"desc":"When the shift ends, an Iso8601 datetime in UTC time","default":""},{"required":false,"desc":"Assigns the shift to a specific worker","default":"","type":"int","name":"user_id","in":"body","_id":"571928e2e967cb1700d07907","ref":""},{"desc":"Determines whether workers can view the shift in My Schedules","default":"","type":"boolean","name":"published","in":"body","_id":"571928e2e967cb1700d07906","ref":"","required":false},{"name":"description","in":"body","_id":"575f121f41c8ba0e00259c1d","ref":"","required":false,"desc":"A custom string that contains additional information about the shift","default":"","type":"string"}],"results":{"codes":[{"name":"","code":"{\n \"user_id\": 2\n}","language":"json","status":200}]},"settings":"","url":"/organizations/:organization_id/locations/:location_id/roles/:role_id/shifts/:shift_id"},"body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Location Member\",\n \"body\": \"Workers are only allowed to claim unassigned shifts for themselves\"\n}\n[/block]\n\n[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Location Manager\",\n \"body\": \"Location managers are able to adjust any property within their location. Organization administrators have access in all locations.\"\n}\n[/block]\n### Claiming a Shift\nMake a patch request to the shift with the only parameter being `user_id` with a value of the User's ID.","excerpt":"","isReference":false,"slug":"modify-a-shift","type":"patch","user":"561da5369ace800d00289ea3","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
patchModify a Shift
Path Params
Body Params
Permission Required: Location Member
Workers are only allowed to claim unassigned shifts for themselves
Permission Required: Location Manager
Location managers are able to adjust any property within their location. Organization administrators have access in all locations.
{"_id":"57192490e967cb1700d078e7","editedParams2":true,"version":"56fa046648e69f0e00a7742f","__v":1,"category":"56fbf89d4c3cea190015da0d","githubsync":"","hidden":false,"link_external":false,"slug":"delete-a-shift","updates":[],"createdAt":"2016-04-21T19:05:52.615Z","order":5,"type":"delete","user":"561da5369ace800d00289ea3","api":{"method":"delete","params":[{"desc":"ID of the organization","default":"","type":"int","name":"organization_id","in":"path","_id":"571925866346850e00833ffd","ref":"","required":true},{"ref":"","required":true,"desc":"ID of the location","default":"","type":"int","name":"location_id","in":"path","_id":"571925866346850e00833ffc"},{"required":true,"desc":"ID of the role","default":"","type":"int","name":"role_id","in":"path","_id":"571925866346850e00833ffb","ref":""},{"default":"","type":"int","name":"shift_id","in":"path","_id":"571925866346850e00833ffa","ref":"","required":true,"desc":"ID of the shift"}],"results":{"codes":[{"name":"","code":"{}","language":"json","status":204}]},"settings":"","url":"/organizations/:organization_id/locations/:location_id/roles/:role_id/shifts/:shift_id","auth":"required","examples":{"codes":[{"language":"curl","code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/shifts/5241 -X DELETE"}]}},"body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Location Manager\",\n \"body\": \"Managers are limited to their location. Organization administrators have access in all locations.\"\n}\n[/block]","editedParams":true,"excerpt":"","isReference":false,"link_url":"","parentDoc":null,"project":"56f9fe2cf9102d0e00ca623e","sync_unique":"","title":"Delete a Shift","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
deleteDelete a Shift
Path Params
Permission Required: Location Manager
Managers are limited to their location. Organization administrators have access in all locations.
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/shifts/5241 -X DELETE
Result Format
{"_id":"571e8764ac2a080e0014c490","api":{"url":"/organizations/:organization_id/locations/:location_id/roles/:role_id/shifts/:shift_id/users/","auth":"required","examples":{"codes":[{"language":"curl","code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/180/locations/250/roles/477/shifts/42490/users/"}]},"method":"get","params":[{"default":"","type":"int","name":"organization_id","in":"path","_id":"5717d6dcf2d4380e006f0286","ref":"","required":true,"desc":"ID of the organization"},{"in":"path","_id":"5717d6dcf2d4380e006f0285","ref":"","required":true,"desc":"ID of the location","default":"","type":"int","name":"location_id"},{"ref":"","required":true,"desc":"ID of the role","default":"","type":"int","name":"role_id","in":"path","_id":"5717d6dcf2d4380e006f0284"},{"required":true,"desc":"ID of the shift","default":"","type":"int","name":"shift_id","in":"path","_id":"5717d6dcf2d4380e006f0283","ref":""}],"results":{"codes":[{"language":"json","code":"{\n \"data\": [\n {\n \"username\": null,\n \"confirmed\": false,\n \"name\": \"Rosalind Franklin\",\n \"active\": true,\n \"member_since\": \"2015-10-22T02:49:48\",\n \"last_seen\": \"2015-10-22T02:49:48\",\n \"sudo\": false,\n \"email\": \"[email protected]\",\n \"id\": 91,\n \"within_caps\": true\n },\n {\n \"username\": null,\n \"confirmed\": false,\n \"name\": \"Max Planck\",\n \"active\": true,\n \"member_since\": \"2015-10-22T02:49:48\",\n \"last_seen\": \"2015-10-22T02:49:48\",\n \"sudo\": false,\n \"email\": \"[email protected]\",\n \"id\": 93,\n \"within_caps\": true\n },\n ]\n}","name":"","status":200}]},"settings":""},"body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Location Admin\",\n \"body\": \"Managers are limited to their location. Organization administrators have access in all locations.\"\n}\n[/block]\n## Notes:\n* The response returns all workers who do not have a shift that overlaps with this shift in question.\n* The `within_caps` field indicates whether this person can be assigned to the shift without violating the scheduling rules from their worker profile.","editedParams2":true,"githubsync":"","isReference":false,"parentDoc":null,"sync_unique":"","updates":[],"createdAt":"2016-04-25T21:08:52.200Z","project":"56f9fe2cf9102d0e00ca623e","type":"get","__v":1,"excerpt":"Returns all users that are able to be assigned to a specific shift.","link_url":"","user":"561da5369ace800d00289ea3","category":"571e8755ebc88a0e008d4fc0","hidden":false,"link_external":false,"order":0,"slug":"shift-eligible-users","title":"Shift Eligible Users","version":"56fa046648e69f0e00a7742f","editedParams":true,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
getShift Eligible Users
Path Params
Permission Required: Location Admin
Managers are limited to their location. Organization administrators have access in all locations.
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/180/locations/250/roles/477/shifts/42490/users/
Result Format
{
"data": [
{
"username": null,
"confirmed": false,
"name": "Rosalind Franklin",
"active": true,
"member_since": "2015-10-22T02:49:48",
"last_seen": "2015-10-22T02:49:48",
"sudo": false,
"email": "[email protected]",
"id": 91,
"within_caps": true
},
{
"username": null,
"confirmed": false,
"name": "Max Planck",
"active": true,
"member_since": "2015-10-22T02:49:48",
"last_seen": "2015-10-22T02:49:48",
"sudo": false,
"email": "[email protected]",
"id": 93,
"within_caps": true
},
]
}
{"_id":"5748d4eb919ad20e00b6c82d","editedParams2":true,"hidden":false,"link_url":"","slug":"all-recurring-shifts","title":"All Recurring Shifts","body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Location Member\",\n \"body\": \"Managers and workers within the location can access this in addition to organization administrators.\"\n}\n[/block]","category":"5748d4835a77a71700965624","isReference":false,"link_external":false,"project":"56f9fe2cf9102d0e00ca623e","order":0,"parentDoc":null,"__v":0,"api":{"auth":"required","examples":{"codes":[{"language":"curl","code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/recurringshifts/"}]},"method":"get","params":[{"type":"int","name":"organization_id","in":"path","_id":"5719251cac1e2e0e001833bc","ref":"","required":true,"desc":"ID of the organization","default":""},{"type":"int","name":"location_id","in":"path","_id":"5719251cac1e2e0e001833bb","ref":"","required":true,"desc":"ID of the location","default":""},{"required":true,"desc":"ID of the role","default":"","type":"int","name":"role_id","in":"path","_id":"5719251cac1e2e0e001833ba","ref":""},{"name":"user_id","ref":"","required":false,"type":"int","in":"query","_id":"57193cd8e967cb1700d07978","default":"","desc":"Filter results by shifts that are assigned to the given User ID. Use 0 to search for unassigned recurring shifts."}],"results":{"codes":[{"name":"","code":"{\n \"data\": [\n {\n \"start_day\": \"monday\",\n \"start_minute\": 0,\n \"user_id\": 1,\n \"duration_minutes\": 480,\n \"quantity\": 1,\n \"start_hour\": 9,\n \"id\": 3,\n \"role_id\": 656\n },\n {\n \"start_day\": \"tuesday\",\n \"start_minute\": 0,\n \"user_id\": 1,\n \"duration_minutes\": 480,\n \"quantity\": 1,\n \"start_hour\": 9,\n \"id\": 4,\n \"role_id\": 656\n },\n ]\n}","language":"json","status":200}]},"settings":"","url":"/organizations/:organization_id/locations/:location_id/roles/:role_id/recurringshifts/"},"createdAt":"2016-05-27T23:14:51.433Z","editedParams":true,"githubsync":"","sync_unique":"","type":"get","updates":[],"user":"561da5369ace800d00289ea3","excerpt":"","version":"56fa046648e69f0e00a7742f","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
getAll Recurring Shifts
Path Params
Query Params
Permission Required: Location Member
Managers and workers within the location can access this in addition to organization administrators.
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/recurringshifts/
Result Format
{
"data": [
{
"start_day": "monday",
"start_minute": 0,
"user_id": 1,
"duration_minutes": 480,
"quantity": 1,
"start_hour": 9,
"id": 3,
"role_id": 656
},
{
"start_day": "tuesday",
"start_minute": 0,
"user_id": 1,
"duration_minutes": 480,
"quantity": 1,
"start_hour": 9,
"id": 4,
"role_id": 656
},
]
}
{"_id":"5748d94cdb72e72d00b2c6de","parentDoc":null,"version":"56fa046648e69f0e00a7742f","category":"5748d4835a77a71700965624","editedParams":true,"excerpt":"","hidden":false,"link_url":"","title":"Create a Recurring Shift","type":"post","updates":[],"__v":0,"api":{"url":"/organizations/:organization_id/locations/:location_id/roles/:role_id/recurringshifts/","auth":"required","examples":{"codes":[{"language":"curl","code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/recurringshifts/ -X POST -d \"start_day=monday\" -d \"start_hour=8\" -d \"start_minute=0\" -d \"duration_minutes=300\" -d \"quantity=2\""}]},"method":"post","params":[{"in":"path","_id":"5719252fb69de41700478477","ref":"","required":true,"desc":"ID of the organization","default":"","type":"int","name":"organization_id"},{"ref":"","required":true,"desc":"ID of the location","default":"","type":"int","name":"location_id","in":"path","_id":"5719252fb69de41700478476"},{"required":true,"desc":"ID of the role","default":"","type":"int","name":"role_id","in":"path","_id":"5719252fb69de41700478475","ref":""},{"default":"","type":"string","name":"start_day","in":"body","_id":"57192a28ac1e2e0e001833d6","ref":"","required":true,"desc":"The day of the week when the shift starts, e.g. \"monday\""},{"in":"body","_id":"57192a28ac1e2e0e001833d5","ref":"","required":true,"desc":"The hour of the day when the shift will start, 0-23","default":"","type":"int","name":"start_hour"},{"default":"","desc":"The minute of the day when the shift will start, 0-59","name":"start_minute","ref":"","required":true,"type":"int","in":"body","_id":"57192a28ac1e2e0e001833d4"},{"required":true,"desc":"The length of the shift, in minutes","default":"","type":"int","name":"duration_minutes","in":"body","_id":"57192a28ac1e2e0e001833d3","ref":""},{"desc":"Recurring shifts can optionally be given to specific workers","default":"","type":"int","name":"user_id","in":"body","_id":"5748d94cdb72e72d00b2c6e0","ref":"","required":false},{"ref":"","required":false,"desc":"If no user_id is defined, a quantity can be given to create multiple shifts","default":"","type":"int","name":"quantity","in":"body","_id":"5748d94cdb72e72d00b2c6df"}],"results":{"codes":[{"code":"{\n \"start_day\": \"monday\",\n \"start_minute\": 0,\n \"user_id\": 0,\n \"duration_minutes\": 300,\n \"quantity\": 2,\n \"start_hour\": 8,\n \"id\": 830,\n \"role_id\": 656\n}","name":"","status":201,"language":"json"}]},"settings":""},"createdAt":"2016-05-27T23:33:32.158Z","link_external":false,"slug":"create-a-recurring","githubsync":"","isReference":false,"sync_unique":"","user":"561da5369ace800d00289ea3","body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Location Manager\",\n \"body\": \"Managers are limited to their location. Organization administrators have access in all locations.\"\n}\n[/block]\n\n[block:callout]\n{\n \"type\": \"warning\",\n \"title\": \"Times are all in local time\",\n \"body\": \"start_day, start_hour, start_minute will create a shift corresponding to that time in the location's timezone\"\n}\n[/block]","editedParams2":true,"order":1,"project":"56f9fe2cf9102d0e00ca623e","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
postCreate a Recurring Shift
Path Params
Body Params
Permission Required: Location Manager
Managers are limited to their location. Organization administrators have access in all locations.
Times are all in local time
start_day, start_hour, start_minute will create a shift corresponding to that time in the location's timezone
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/recurringshifts/ -X POST -d "start_day=monday" -d "start_hour=8" -d "start_minute=0" -d "duration_minutes=300" -d "quantity=2"
Result Format
{
"start_day": "monday",
"start_minute": 0,
"user_id": 0,
"duration_minutes": 300,
"quantity": 2,
"start_hour": 8,
"id": 830,
"role_id": 656
}
{"_id":"571924784604d417003d2438","title":"Recurring Shift","version":"56fa046648e69f0e00a7742f","__v":1,"body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Location Member\",\n \"body\": \"Managers and workers within the location can access this in addition to organization administrators.\"\n}\n[/block]","githubsync":"","sync_unique":"","api":{"auth":"required","examples":{"codes":[{"language":"curl","code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/recurringshifts/830"}]},"method":"get","params":[{"name":"organization_id","in":"path","_id":"5719254c6346850e00833ff9","ref":"","required":true,"desc":"ID of the organization","default":"","type":"int"},{"default":"","type":"int","name":"location_id","in":"path","_id":"5719254c6346850e00833ff8","ref":"","required":true,"desc":"ID of the location"},{"_id":"5719254c6346850e00833ff7","ref":"","required":true,"desc":"ID of the role","default":"","type":"int","name":"role_id","in":"path"},{"_id":"5719254c6346850e00833ff6","default":"","desc":"ID of the recurring shift","name":"recurring_shift_id","ref":"","required":true,"type":"int","in":"path"}],"results":{"codes":[{"status":200,"language":"json","code":"{\n \"data\": {\n \"start_day\": \"monday\",\n \"start_minute\": 0,\n \"user_id\": 0,\n \"duration_minutes\": 300,\n \"quantity\": 2,\n \"start_hour\": 8,\n \"id\": 830,\n \"role_id\": 656\n },\n \"resources\": []\n}","name":""}]},"settings":"","url":"/organizations/:organization_id/locations/:location_id/roles/:role_id/recurringshifts/:recurring_shift_id"},"isReference":false,"link_external":false,"slug":"shift","order":2,"parentDoc":null,"project":"56f9fe2cf9102d0e00ca623e","updates":[],"category":"5748d4835a77a71700965624","editedParams":true,"excerpt":"","link_url":"","type":"get","user":"561da5369ace800d00289ea3","createdAt":"2016-04-21T19:05:28.963Z","editedParams2":true,"hidden":false,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
getRecurring Shift
Path Params
Permission Required: Location Member
Managers and workers within the location can access this in addition to organization administrators.
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/recurringshifts/830
Result Format
{
"data": {
"start_day": "monday",
"start_minute": 0,
"user_id": 0,
"duration_minutes": 300,
"quantity": 2,
"start_hour": 8,
"id": 830,
"role_id": 656
},
"resources": []
}
{"_id":"5748d9d4919ad20e00b6c831","hidden":false,"link_external":false,"order":3,"__v":0,"body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Location Manager\",\n \"body\": \"Managers are limited to their location. Organization administrators have access in all locations.\"\n}\n[/block]\n\n[block:callout]\n{\n \"type\": \"warning\",\n \"title\": \"Times are all in local time\",\n \"body\": \"start_day, start_hour, start_minute will create a shift corresponding to that time in the location's timezone\"\n}\n[/block]","excerpt":"","githubsync":"","project":"56f9fe2cf9102d0e00ca623e","updates":[],"api":{"auth":"required","examples":{"codes":[{"language":"curl","code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/recurringshifts/830 -X PATCH -d \"quantity=4\""}]},"method":"patch","params":[{"ref":"","required":true,"desc":"ID of the organization","default":"","type":"int","name":"organization_id","in":"path","_id":"5719252fb69de41700478477"},{"required":true,"desc":"ID of the location","default":"","type":"int","name":"location_id","in":"path","_id":"5719252fb69de41700478476","ref":""},{"default":"","type":"int","name":"role_id","in":"path","_id":"5719252fb69de41700478475","ref":"","required":true,"desc":"ID of the role"},{"_id":"5748d9d4919ad20e00b6c832","ref":"","required":true,"desc":"ID of the recurring shift","default":"","type":"int","name":"recurring_shift_id","in":"path"},{"in":"body","_id":"57192a28ac1e2e0e001833d6","default":"","desc":"The day of the week when the shift starts, e.g. \"monday\"","name":"start_day","ref":"","required":false,"type":"string"},{"type":"int","in":"body","_id":"57192a28ac1e2e0e001833d5","default":"","desc":"The hour of the day when the shift will start, 0-23","name":"start_hour","ref":"","required":false},{"ref":"","required":false,"type":"int","in":"body","_id":"57192a28ac1e2e0e001833d4","default":"","desc":"The minute of the day when the shift will start, 0-59","name":"start_minute"},{"_id":"57192a28ac1e2e0e001833d3","default":"","desc":"The length of the shift, in minutes","name":"duration_minutes","ref":"","required":false,"type":"int","in":"body"},{"in":"body","_id":"5748d94cdb72e72d00b2c6e0","ref":"","required":false,"desc":"Recurring shifts can optionally be given to specific workers","default":"","type":"int","name":"user_id"},{"name":"quantity","in":"body","_id":"5748d94cdb72e72d00b2c6df","ref":"","required":false,"desc":"If no user_id is defined, a quantity can be given to create multiple shifts","default":"","type":"int"}],"results":{"codes":[{"name":"","code":"{\n \"quantity\": 4\n}","language":"json","status":201}]},"settings":"","url":"/organizations/:organization_id/locations/:location_id/roles/:role_id/recurringshifts/:recurring_shift_id"},"createdAt":"2016-05-27T23:35:48.341Z","editedParams":true,"editedParams2":true,"parentDoc":null,"category":"5748d4835a77a71700965624","isReference":false,"sync_unique":"","title":"Modify a Recurring Shift","user":"561da5369ace800d00289ea3","link_url":"","slug":"modify-a-recurring-shift","type":"patch","version":"56fa046648e69f0e00a7742f","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
patchModify a Recurring Shift
Path Params
Body Params
Permission Required: Location Manager
Managers are limited to their location. Organization administrators have access in all locations.
Times are all in local time
start_day, start_hour, start_minute will create a shift corresponding to that time in the location's timezone
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/recurringshifts/830 -X PATCH -d "quantity=4"
Result Format
{
"quantity": 4
}
{"_id":"5748d9f9b3ae442b003af2f7","editedParams2":true,"githubsync":"","isReference":false,"order":4,"parentDoc":null,"slug":"delete-a-recurring-shift","title":"Delete a Recurring Shift","__v":0,"body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Location Manager\",\n \"body\": \"Managers are limited to their location. Organization administrators have access in all locations.\"\n}\n[/block]\n\n[block:callout]\n{\n \"type\": \"warning\",\n \"title\": \"Times are all in local time\",\n \"body\": \"start_day, start_hour, start_minute will create a shift corresponding to that time in the location's timezone\"\n}\n[/block]","link_external":false,"type":"delete","version":"56fa046648e69f0e00a7742f","createdAt":"2016-05-27T23:36:25.802Z","editedParams":true,"excerpt":"","link_url":"","sync_unique":"","updates":[],"user":"561da5369ace800d00289ea3","api":{"examples":{"codes":[{"language":"curl","code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/recurringshifts/830 -X DELETE"}]},"method":"delete","params":[{"type":"int","name":"organization_id","in":"path","_id":"5719252fb69de41700478477","ref":"","required":true,"desc":"ID of the organization","default":""},{"required":true,"desc":"ID of the location","default":"","type":"int","name":"location_id","in":"path","_id":"5719252fb69de41700478476","ref":""},{"desc":"ID of the role","default":"","type":"int","name":"role_id","in":"path","_id":"5719252fb69de41700478475","ref":"","required":true},{"ref":"","required":true,"desc":"ID of the recurring shift","default":"","type":"int","name":"recurring_shift_id","in":"path","_id":"5748d9d4919ad20e00b6c832"}],"results":{"codes":[{"name":"","status":204,"language":"json","code":"{}"}]},"settings":"","url":"/organizations/:organization_id/locations/:location_id/roles/:role_id/recurringshifts/:recurring_shift_id","auth":"required"},"category":"5748d4835a77a71700965624","hidden":false,"project":"56f9fe2cf9102d0e00ca623e","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
deleteDelete a Recurring Shift
Path Params
Permission Required: Location Manager
Managers are limited to their location. Organization administrators have access in all locations.
Times are all in local time
start_day, start_hour, start_minute will create a shift corresponding to that time in the location's timezone
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/recurringshifts/830 -X DELETE
Result Format
{"_id":"571942e66346850e0083409d","title":"Timeclocks Overview","__v":3,"api":{"settings":"","url":"","auth":"required","params":[],"results":{"codes":[{"name":"","status":200,"language":"json","code":"{}"},{"language":"json","code":"{}","name":"","status":400}]}},"category":"571942d3ac1e2e0e0018346f","excerpt":"","link_external":false,"link_url":"","hidden":false,"order":0,"slug":"timeclocks-overview","type":"basic","updates":[],"version":"56fa046648e69f0e00a7742f","createdAt":"2016-04-21T21:15:18.901Z","githubsync":"","sync_unique":"","body":"A timeclock represents a span of time when a worker was on the job.\n\n## Attributes:\n\n* id (int) - A unique identifier\n* role_id (int) - The ID of the role the user works in\n* user_id (int) - The ID of the user who recorded the timeclock\n* start (Iso8601 datetime) - Determines when the timeclock began, in UTC\n* stop (Iso8601 datetime) - Determines when the timeclock ended, in UTC\n\n## Notes:\n\n* A user can only have one timeclock record at a time.\n* If stop is null, then the worker is still clocked in.\n* The start and end times are stored in UTC in the Staffjoy database, and all queries to search the database need datetime values to be in UTC as well.\n* Timeclocks are allowed to be up to 23 hours long, workers will automatically be clocked out if they forget to clock out.\n* Timeclocks are specific to a role. If a worker is moved to a different role, new timeclocks would be created on a route with the new role_id.","isReference":false,"parentDoc":null,"project":"56f9fe2cf9102d0e00ca623e","user":"561da5369ace800d00289ea3","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
Timeclocks Overview
A timeclock represents a span of time when a worker was on the job.
Attributes:
- id (int) - A unique identifier
- role_id (int) - The ID of the role the user works in
- user_id (int) - The ID of the user who recorded the timeclock
- start (Iso8601 datetime) - Determines when the timeclock began, in UTC
- stop (Iso8601 datetime) - Determines when the timeclock ended, in UTC
Notes:
- A user can only have one timeclock record at a time.
- If stop is null, then the worker is still clocked in.
- The start and end times are stored in UTC in the Staffjoy database, and all queries to search the database need datetime values to be in UTC as well.
- Timeclocks are allowed to be up to 23 hours long, workers will automatically be clocked out if they forget to clock out.
- Timeclocks are specific to a role. If a worker is moved to a different role, new timeclocks would be created on a route with the new role_id.
{"_id":"571942f7ac1e2e0e00183471","createdAt":"2016-04-21T21:15:35.036Z","hidden":false,"version":"56fa046648e69f0e00a7742f","__v":2,"link_url":"","user":"561da5369ace800d00289ea3","link_external":false,"category":"571942d3ac1e2e0e0018346f","editedParams":true,"editedParams2":true,"excerpt":"","githubsync":"","isReference":false,"order":1,"parentDoc":null,"sync_unique":"","title":"All Timeclocks","api":{"settings":"","url":"/organizations/:organization_id/locations/:location_id/roles/:role_id/users/:user_id/timeclocks/","auth":"required","examples":{"codes":[{"language":"curl","code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/users/2/timeclocks/"}]},"method":"get","params":[{"_id":"571945126346850e008340aa","ref":"","required":true,"desc":"ID of the organization","default":"","type":"int","name":"organization_id","in":"path"},{"_id":"571945126346850e008340a9","ref":"","required":true,"desc":"ID of the location","default":"","type":"int","name":"location_id","in":"path"},{"in":"path","_id":"571945126346850e008340a8","ref":"","required":true,"desc":"ID of the role","default":"","type":"int","name":"role_id"},{"name":"user_id","in":"path","_id":"571945126346850e008340a7","ref":"","required":true,"desc":"ID of the user","default":"","type":"int"},{"default":"","type":"boolean","name":"active","in":"query","_id":"57194648b69de4170047851a","ref":"","required":false,"desc":"If true, will only search for active timeclocks by the user"},{"_id":"57194648b69de41700478519","ref":"","required":false,"desc":"Searches for timeclocks that start after this time (Iso8601 datetime)","default":"","type":"datetime","name":"start","in":"query"},{"in":"query","_id":"57194648b69de41700478518","ref":"","required":false,"desc":"Searches for timeclocks that start before this time (Iso8601 datetime)","default":"","type":"datetime","name":"end"}],"results":{"codes":[{"code":"{\n \"data\": [\n {\n \"user_id\": 2,\n \"stop\": \"2016-04-21T21:39:17\",\n \"role_id\": 656,\n \"start\": \"2016-04-21T16:01:19\",\n \"id\": 9360\n },\n {\n \"user_id\": 2,\n \"stop\": \"2016-04-20T14:01:00\",\n \"role_id\": 656,\n \"start\": \"2016-04-19T15:01:00\",\n \"id\": 9388\n }\n ]\n}","name":"","status":200,"language":"json"}]}},"body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Location Manager or Individual\",\n \"body\": \"Managers are limited to their location. Organization administrators have access in all locations. Workers are able to access their own data.\"\n}\n[/block]\nIf no values are given for `start` and `end`, the query will default to the past week. The best practice is to always query for a specific span of time.","project":"56f9fe2cf9102d0e00ca623e","slug":"all-timeclocks","type":"get","updates":[],"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
getAll Timeclocks
Path Params
Query Params
Permission Required: Location Manager or Individual
Managers are limited to their location. Organization administrators have access in all locations. Workers are able to access their own data.
If no values are given for start
and end
, the query will default to the past week. The best practice is to always query for a specific span of time.
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/users/2/timeclocks/
Result Format
{
"data": [
{
"user_id": 2,
"stop": "2016-04-21T21:39:17",
"role_id": 656,
"start": "2016-04-21T16:01:19",
"id": 9360
},
{
"user_id": 2,
"stop": "2016-04-20T14:01:00",
"role_id": 656,
"start": "2016-04-19T15:01:00",
"id": 9388
}
]
}
{"_id":"57194302ac1e2e0e00183474","editedParams2":true,"link_external":false,"project":"56f9fe2cf9102d0e00ca623e","title":"Create a Timeclock","type":"post","version":"56fa046648e69f0e00a7742f","body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Individual\",\n \"body\": \"Individuals are able to clock themselves in at the current time\"\n}\n[/block]\n\n[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Location Manager\",\n \"body\": \"Managers have full control but are limited to their location. Organization administrators have control in all locations.\"\n}\n[/block]\n## Clocking In\nTo clock in, simply create a POST request without any parameters. That will create a record at the current time.","createdAt":"2016-04-21T21:15:46.866Z","editedParams":true,"isReference":false,"slug":"create-a-timeclock","updates":[],"user":"561da5369ace800d00289ea3","__v":3,"hidden":false,"link_url":"","githubsync":"","category":"571942d3ac1e2e0e0018346f","excerpt":"","order":2,"parentDoc":null,"sync_unique":"","api":{"auth":"required","examples":{"codes":[{"language":"curl","code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/users/2/timeclocks/ -X POST"}]},"method":"post","params":[{"default":"","type":"int","name":"organization_id","in":"path","_id":"571944b84604d417003d24dc","ref":"","required":true,"desc":"ID of the organization"},{"_id":"571944eee967cb1700d079bc","ref":"","required":true,"desc":"ID of the location","default":"","type":"int","name":"location_id","in":"path"},{"_id":"571944eee967cb1700d079bb","ref":"","required":true,"desc":"ID of the role","default":"","type":"int","name":"role_id","in":"path"},{"in":"path","_id":"571944eee967cb1700d079ba","ref":"","required":true,"desc":"ID of the user","default":"","type":"int","name":"user_id"},{"ref":"","required":false,"desc":"Iso8601 datetime of when the timeclock began","default":"","type":"datetime","name":"start","in":"body","_id":"57194680c863120e00129fab"},{"required":false,"type":"datetime","in":"body","_id":"57194680c863120e00129faa","default":"","desc":"Iso8601 datetime of when the timeclock ended","name":"stop","ref":""}],"results":{"codes":[{"name":"","status":201,"language":"json","code":"{\n \"user_id\": 2,\n \"stop\": null,\n \"role_id\": 656,\n \"start\": \"2016-04-21T21:53:38\",\n \"id\": 9390\n}"}]},"settings":"","url":"/organizations/:organization_id/locations/:location_id/roles/:role_id/users/:user_id/timeclocks/"},"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
postCreate a Timeclock
Path Params
Body Params
Permission Required: Individual
Individuals are able to clock themselves in at the current time
Permission Required: Location Manager
Managers have full control but are limited to their location. Organization administrators have control in all locations.
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/users/2/timeclocks/ -X POST
Result Format
{
"user_id": 2,
"stop": null,
"role_id": 656,
"start": "2016-04-21T21:53:38",
"id": 9390
}
{"_id":"571943106346850e008340a0","project":"56f9fe2cf9102d0e00ca623e","slug":"timeclock","type":"get","api":{"params":[{"ref":"","required":true,"desc":"ID of the organization","default":"","type":"int","name":"organization_id","in":"path","_id":"57194451ac1e2e0e0018348d"},{"required":true,"desc":"ID of the location","default":"","type":"int","name":"location_id","in":"path","_id":"57194451ac1e2e0e0018348c","ref":""},{"desc":"ID of the role","default":"","type":"int","name":"role_id","in":"path","_id":"57194451ac1e2e0e0018348b","ref":"","required":true},{"ref":"","required":true,"desc":"ID of the user","default":"","type":"int","name":"user_id","in":"path","_id":"57194451ac1e2e0e0018348a"},{"type":"int","name":"timeclock_id","in":"path","_id":"571944646346850e008340a4","ref":"","required":true,"desc":"ID of the timeclock","default":""}],"results":{"codes":[{"name":"","status":200,"language":"json","code":"{\n \"data\": {\n \"user_id\": 2,\n \"stop\": \"2016-04-21T21:39:17\",\n \"role_id\": 656,\n \"start\": \"2016-04-21T16:01:19\",\n \"id\": 9360\n },\n \"resources\": []\n}"}]},"settings":"","url":"/organizations/:organization_id/locations/:location_id/roles/:role_id/users/:user_id/timeclocks/:timeclock_id","auth":"required","examples":{"codes":[{"language":"curl","code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/users/2/timeclocks/9360"}]},"method":"get"},"category":"571942d3ac1e2e0e0018346f","editedParams":true,"githubsync":"","isReference":false,"user":"561da5369ace800d00289ea3","__v":2,"body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Location Manager or Individual\",\n \"body\": \"Managers are limited to their location. Organization administrators have access in all locations. Workers are able to access their own data.\"\n}\n[/block]","link_url":"","parentDoc":null,"sync_unique":"","order":3,"title":"Timeclock","updates":[],"createdAt":"2016-04-21T21:16:00.870Z","editedParams2":true,"excerpt":"","hidden":false,"link_external":false,"version":"56fa046648e69f0e00a7742f","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
getTimeclock
Path Params
Permission Required: Location Manager or Individual
Managers are limited to their location. Organization administrators have access in all locations. Workers are able to access their own data.
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/users/2/timeclocks/9360
Result Format
{
"data": {
"user_id": 2,
"stop": "2016-04-21T21:39:17",
"role_id": 656,
"start": "2016-04-21T16:01:19",
"id": 9360
},
"resources": []
}
{"_id":"5719431aac1e2e0e00183478","project":"56f9fe2cf9102d0e00ca623e","user":"561da5369ace800d00289ea3","version":"56fa046648e69f0e00a7742f","githubsync":"","category":"571942d3ac1e2e0e0018346f","isReference":false,"link_external":false,"order":4,"__v":3,"api":{"auth":"required","examples":{"codes":[{"code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/users/2/timeclocks/9390 -X PATCH -d \"close=true\"\n","language":"curl"}]},"method":"patch","params":[{"type":"int","name":"organization_id","in":"path","_id":"57194401e967cb1700d079b2","ref":"","required":true,"desc":"ID of the organization","default":""},{"type":"int","name":"location_id","in":"path","_id":"57194401e967cb1700d079b1","ref":"","required":true,"desc":"ID of the location","default":""},{"required":true,"desc":"ID of the role","default":"","type":"int","name":"role_id","in":"path","_id":"57194401e967cb1700d079b0","ref":""},{"default":"","type":"int","name":"user_id","in":"path","_id":"57194401e967cb1700d079af","ref":"","required":true,"desc":"ID of the user"},{"in":"path","_id":"5719441bac1e2e0e00183488","ref":"","required":true,"desc":"ID of the timeclock","default":"","type":"int","name":"timeclock_id"},{"ref":"","required":false,"desc":"Adjusts the start time to the given time. Iso8601 datetime","default":"","type":"datetime","name":"start","in":"body","_id":"571946f4c863120e00129faf"},{"type":"datetime","name":"stop","in":"body","_id":"571946f4c863120e00129fae","ref":"","required":false,"desc":"Adjusts the stop time to the given time. Iso8601 datetime","default":""},{"required":false,"desc":"When true, it will close a timeclock at the current time","default":"","type":"boolean","name":"close","in":"body","_id":"571946f4c863120e00129fad","ref":""}],"results":{"codes":[{"status":200,"language":"json","code":"{\n \"stop\": \"2016-04-21T22:41:09.289093+00:00\"\n}","name":""}]},"settings":"","url":"/organizations/:organization_id/locations/:location_id/roles/:role_id/users/:user_id/timeclocks/:timeclock_id"},"editedParams2":true,"hidden":false,"parentDoc":null,"slug":"modify-a-timeclock","sync_unique":"","createdAt":"2016-04-21T21:16:10.875Z","editedParams":true,"excerpt":"","link_url":"","title":"Modify a Timeclock","type":"patch","updates":[],"body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Individual\",\n \"body\": \"Individuals are allowed to clock out of an open timeclock at the current time via the close=true parameter.\"\n}\n[/block]\n\n[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Location Manager\",\n \"body\": \"Managers are able to modify any timeclock within their location. Organization administrators have access in all locations.\"\n}\n[/block]\n## Clocking Out\nTo clock out of a shift, make a PATCH request with the parameter `close=true`. It will set stop to the current time.","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
patchModify a Timeclock
Path Params
Body Params
Permission Required: Individual
Individuals are allowed to clock out of an open timeclock at the current time via the close=true parameter.
Permission Required: Location Manager
Managers are able to modify any timeclock within their location. Organization administrators have access in all locations.
{"_id":"57194327b69de41700478503","sync_unique":"","user":"561da5369ace800d00289ea3","__v":2,"body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Location Manager\",\n \"body\": \"Managers are able to delete any timeclock within their location. Organization administrators have access in all locations.\"\n}\n[/block]","githubsync":"","isReference":false,"project":"56f9fe2cf9102d0e00ca623e","api":{"auth":"required","examples":{"codes":[{"language":"text","code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/users/2/timeclocks/9390 -X DELETE"}]},"method":"delete","params":[{"_id":"571943a84604d417003d24d6","ref":"","required":true,"desc":"ID of the organization","default":"","type":"int","name":"organization_id","in":"path"},{"_id":"571943a84604d417003d24d5","ref":"","required":true,"desc":"ID of the location","default":"","type":"int","name":"location_id","in":"path"},{"_id":"571943cdac1e2e0e00183483","ref":"","required":true,"desc":"ID of the role","default":"","type":"int","name":"role_id","in":"path"},{"in":"path","_id":"571943cdac1e2e0e00183482","ref":"","required":true,"desc":"ID of the user","default":"","type":"int","name":"user_id"},{"ref":"","required":true,"desc":"ID of the timeclock","default":"","type":"int","name":"timeclock_id","in":"path","_id":"571943cdac1e2e0e00183481"}],"results":{"codes":[{"name":"","status":204,"language":"json","code":"{}"}]},"settings":"","url":"/organizations/:organization_id/locations/:location_id/roles/:role_id/users/:user_id/timeclocks/:timeclock_id"},"category":"571942d3ac1e2e0e0018346f","createdAt":"2016-04-21T21:16:23.346Z","link_external":false,"parentDoc":null,"slug":"delete-a-timeclock","type":"delete","editedParams":true,"hidden":false,"order":5,"title":"Delete a Timeclock","updates":[],"version":"56fa046648e69f0e00a7742f","editedParams2":true,"excerpt":"","link_url":"","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
deleteDelete a Timeclock
Path Params
Permission Required: Location Manager
Managers are able to delete any timeclock within their location. Organization administrators have access in all locations.
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/users/2/timeclocks/9390 -X DELETE
Result Format
{"_id":"57195aca4604d417003d2528","category":"5719456eb69de41700478511","createdAt":"2016-04-21T22:57:14.982Z","githubsync":"","isReference":false,"order":0,"slug":"time-off-requests-overview","sync_unique":"","__v":4,"title":"Time Off Requests Overview","link_external":false,"link_url":"","parentDoc":null,"body":"A time off request \n\n## Attributes:\n\n* id (int) - A unique identifier\n* role_id (int) - the ID of the role that the user belongs to\n* user_id (int) - the ID of the user\n* role_to_user_id (int) - Maps the relationship between a user and a role - don't worry about this\n* start (Iso8601 datetime) - Determines when the time off request starts, in UTC\n* stop (Iso8601 datetime) - Determines when the time off request ends, in UTC\n* state (string) - The current state of the time off request. See below for details on each state.\n* minutes_paid (int) - The amount minutes that will be paid for this time off request.\n\n## States:\n* null - When a worker has requested time off, it starts in the null state. Time off requests in the null state require action from a manager.\n* approved_paid - Time off has been approved and a worker will be paid an amount designated by the minutes_paid field, which must be greater than 0.\n* approved_unpaid - Time off has been approved, but a worker will not be paid for it. minutes_paid must be 0.\n* sick - This is a special type of time off that is independent of minutes_paid because rules will differ between different organizations.\n\n## Notes:\n\n* All time off requests span for exactly one calendar day and start at midnight in the location's timezone.\n* A user can only have one time off request record for a calendar day\n* The start and end times are stored in UTC in the Staffjoy database, and all queries to search the database need datetime values to be in UTC as well.\n* `minutes_paid` must be greater than 0 if the `state` is `approved_paid`; it must be 0 if the `state` is `approved_unpaid`","api":{"results":{"codes":[{"language":"json","code":"{}","name":"","status":200},{"code":"{}","name":"","status":400,"language":"json"}]},"settings":"","url":"","auth":"required","params":[]},"updates":[],"version":"56fa046648e69f0e00a7742f","hidden":false,"project":"56f9fe2cf9102d0e00ca623e","type":"basic","user":"561da5369ace800d00289ea3","excerpt":"","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
Time Off Requests Overview
A time off request
Attributes:
- id (int) - A unique identifier
- role_id (int) - the ID of the role that the user belongs to
- user_id (int) - the ID of the user
- role_to_user_id (int) - Maps the relationship between a user and a role - don't worry about this
- start (Iso8601 datetime) - Determines when the time off request starts, in UTC
- stop (Iso8601 datetime) - Determines when the time off request ends, in UTC
- state (string) - The current state of the time off request. See below for details on each state.
- minutes_paid (int) - The amount minutes that will be paid for this time off request.
States:
- null - When a worker has requested time off, it starts in the null state. Time off requests in the null state require action from a manager.
- approved_paid - Time off has been approved and a worker will be paid an amount designated by the minutes_paid field, which must be greater than 0.
- approved_unpaid - Time off has been approved, but a worker will not be paid for it. minutes_paid must be 0.
- sick - This is a special type of time off that is independent of minutes_paid because rules will differ between different organizations.
Notes:
- All time off requests span for exactly one calendar day and start at midnight in the location's timezone.
- A user can only have one time off request record for a calendar day
- The start and end times are stored in UTC in the Staffjoy database, and all queries to search the database need datetime values to be in UTC as well.
minutes_paid
must be greater than 0 if thestate
isapproved_paid
; it must be 0 if thestate
isapproved_unpaid
{"_id":"57195ab9b69de41700478576","createdAt":"2016-04-21T22:56:57.334Z","githubsync":"","isReference":false,"link_external":false,"link_url":"","title":"All Time Off Requests","body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Location Manager or Individual\",\n \"body\": \"Managers are limited to their location. Organization administrators have access in all locations. Workers are able to access their own data.\"\n}\n[/block]\nIf no values are given for `start` and `end`, the query will default to the past week. The best practice is to always query for a specific span of time.","editedParams2":true,"parentDoc":null,"project":"56f9fe2cf9102d0e00ca623e","sync_unique":"","type":"get","editedParams":true,"order":1,"user":"561da5369ace800d00289ea3","version":"56fa046648e69f0e00a7742f","api":{"params":[{"ref":"","required":true,"desc":"ID of the organization","default":"","type":"int","name":"organization_id","in":"path","_id":"571945126346850e008340aa"},{"type":"int","name":"location_id","in":"path","_id":"571945126346850e008340a9","ref":"","required":true,"desc":"ID of the location","default":""},{"type":"int","name":"role_id","in":"path","_id":"571945126346850e008340a8","ref":"","required":true,"desc":"ID of the role","default":""},{"required":true,"desc":"ID of the user","default":"","type":"int","name":"user_id","in":"path","_id":"571945126346850e008340a7","ref":""},{"default":"","type":"datetime","name":"start","in":"query","_id":"57194648b69de41700478519","ref":"","required":false,"desc":"Searches for time off requests that start after this time (Iso8601 datetime)"},{"in":"query","_id":"57194648b69de41700478518","ref":"","required":false,"desc":"Searches for time off requests that start before this time (Iso8601 datetime)","default":"","type":"datetime","name":"end"},{"name":"state","in":"query","_id":"57194648b69de4170047851a","ref":"","required":false,"desc":"Filter results by a specific state","default":"","type":"string"}],"results":{"codes":[{"status":200,"language":"json","code":"{\n \"data\": [\n {\n \"user_id\": 2,\n \"stop\": \"2016-04-21T21:39:17\",\n \"role_id\": 656,\n \"organization_id\": 1,\n \"start\": \"2016-04-21T16:01:19\",\n \"location_id\": 6,\n \"id\": 9360\n },\n {\n \"user_id\": 2,\n \"stop\": \"2016-04-20T14:01:00\",\n \"role_id\": 656,\n \"organization_id\": 1,\n \"start\": \"2016-04-19T15:01:00\",\n \"location_id\": 6,\n \"id\": 9388\n }\n ]\n}","name":""}]},"settings":"","url":"/organizations/:organization_id/locations/:location_id/roles/:role_id/users/:user_id/timeoffrequests/","auth":"required","examples":{"codes":[{"code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/users/2/timeoffrequests/ -d \"start=2016-03-01\"","language":"curl"}]},"method":"get"},"category":"5719456eb69de41700478511","excerpt":"","hidden":false,"slug":"all-time-off-requests","updates":[],"__v":1,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
getAll Time Off Requests
Path Params
Query Params
Permission Required: Location Manager or Individual
Managers are limited to their location. Organization administrators have access in all locations. Workers are able to access their own data.
If no values are given for start
and end
, the query will default to the past week. The best practice is to always query for a specific span of time.
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/users/2/timeoffrequests/ -d "start=2016-03-01"
Result Format
{
"data": [
{
"user_id": 2,
"stop": "2016-04-21T21:39:17",
"role_id": 656,
"organization_id": 1,
"start": "2016-04-21T16:01:19",
"location_id": 6,
"id": 9360
},
{
"user_id": 2,
"stop": "2016-04-20T14:01:00",
"role_id": 656,
"organization_id": 1,
"start": "2016-04-19T15:01:00",
"location_id": 6,
"id": 9388
}
]
}
{"_id":"57195ad74604d417003d252a","createdAt":"2016-04-21T22:57:27.836Z","editedParams":true,"isReference":false,"link_external":false,"user":"561da5369ace800d00289ea3","category":"5719456eb69de41700478511","editedParams2":true,"hidden":false,"link_url":"","project":"56f9fe2cf9102d0e00ca623e","sync_unique":"","api":{"auth":"required","examples":{"codes":[{"code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/users/2/timeoffrequests/ -X POST -d \"date=2016-05-11\"","language":"curl"}]},"method":"post","params":[{"_id":"571944b84604d417003d24dc","ref":"","required":true,"desc":"ID of the organization","default":"","type":"int","name":"organization_id","in":"path"},{"_id":"571944eee967cb1700d079bc","ref":"","required":true,"desc":"ID of the location","default":"","type":"int","name":"location_id","in":"path"},{"in":"path","_id":"571944eee967cb1700d079bb","ref":"","required":true,"desc":"ID of the role","default":"","type":"int","name":"role_id"},{"name":"user_id","in":"path","_id":"571944eee967cb1700d079ba","ref":"","required":true,"desc":"ID of the user","default":"","type":"int"},{"ref":"","required":true,"type":"datetime","in":"body","_id":"57194680c863120e00129fab","default":"","desc":"Iso8601 datetime of the calendar date when time is being requested off","name":"date"},{"_id":"57194680c863120e00129faa","default":"","desc":"The number of minutes being paid with this request","name":"minutes_paid","ref":"","required":false,"type":"int","in":"body"},{"in":"body","_id":"57197bcbc863120e0012a0a3","default":"","desc":"The type of time off being requested","name":"state","ref":"","required":false,"type":"string"}],"results":{"codes":[{"status":201,"language":"json","code":"{\n \"start\": \"2016-05-11T07:00:00\",\n \"state\": null,\n \"user_id\": 2,\n \"approver_user_id\": 0,\n \"minutes_paid\": 0,\n \"stop\": \"2016-05-12T07:00:00\",\n \"id\": 14,\n \"role_id\": 41\n}","name":""}]},"settings":"","url":"/organizations/:organization_id/locations/:location_id/roles/:role_id/users/:user_id/timeoffrequests/"},"githubsync":"","order":2,"body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Individual\",\n \"body\": \"Individuals are able to request time off for themselves but state and minutes_paid must be undefined\"\n}\n[/block]\n\n[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Location Manager\",\n \"body\": \"Managers are limited to their location. Organization administrators have access in all locations.\"\n}\n[/block]","excerpt":"","parentDoc":null,"slug":"create-a-time-off-request","title":"Create a Time Off Request","type":"post","updates":[],"__v":1,"version":"56fa046648e69f0e00a7742f","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}
postCreate a Time Off Request
Path Params
Body Params
Permission Required: Individual
Individuals are able to request time off for themselves but state and minutes_paid must be undefined
Permission Required: Location Manager
Managers are limited to their location. Organization administrators have access in all locations.
Definition
Examples
curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/users/2/timeoffrequests/ -X POST -d "date=2016-05-11"
Result Format
{
"start": "2016-05-11T07:00:00",
"state": null,
"user_id": 2,
"approver_user_id": 0,
"minutes_paid": 0,
"stop": "2016-05-12T07:00:00",
"id": 14,
"role_id": 41
}
{"_id":"57195ae5b69de4170047857a","editedParams":true,"hidden":false,"link_external":false,"user":"561da5369ace800d00289ea3","version":"56fa046648e69f0e00a7742f","body":"[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Permission Required: Location Manager or Individual\",\n \"body\": \"Managers are limited to their location. Organization administrators have access in all locations. Workers are able to access their own data.\"\n}\n[/block]","category":"5719456eb69de41700478511","createdAt":"2016-04-21T22:57:41.452Z","githubsync":"","parentDoc":null,"slug":"time-off-request","type":"get","__v":0,"link_url":"","sync_unique":"","title":"Time Off Request","updates":[],"editedParams2":true,"excerpt":"","order":3,"project":"56f9fe2cf9102d0e00ca623e","api":{"auth":"required","examples":{"codes":[{"code":"curl -u [[app:api-token]]: https://suite.staffjoy.com/api/v2/organizations/1/locations/6/roles/656/users/2/timeoffrequests/369","language":"curl"}]},"method":"get","params":[{"default":"","type":"int","name":"organization_id","in":"path","_id":"57194451ac1e2e0e0018348d","ref":"","required":true,"desc":"ID of the organization"},{"in":"path","_id":"57194451ac1e2e0e0018348c","ref":"","required":true,"desc":"ID of the location","default":"","type":"int","name":"location_id"},{"name":"role_id","in":"path","_id":"57194451ac1e2e0e0018348b","ref":"&quo