### Get User Request Example Source: https://dev.wheniwork.com/ This cURL command demonstrates how to fetch a specific user's details using their ID. Ensure you include your W-Token for authorization. ```shell curl https://api.wheniwork.com/2/users/4364 \ -H "W-Token: ilovemyboss" ``` -------------------------------- ### Example Feature Set Source: https://dev.wheniwork.com/external/monolith/docs-master.json Illustrates the structure of the 'featureSet' object, which defines features enabled by a subscription. This is only populated when the subscription status is 'available'. ```json { "featureSet": { "attendance": true, "auto-assign": true, "coverage-view": true, "custom-timeoff-types": true, "doc-storage": true, } } ``` -------------------------------- ### User Object Response Sample Source: https://dev.wheniwork.com/ This is a sample JSON response for a successful GET /2/users request, illustrating the structure of a user object. ```json { "users": [ { "id": 10000, "login_id": 10000, "account_id": 10000, "role": 1, "email": "jdoe@wheniwork.com", "first_name": "John", "middle_name": "Alan", "last_name": "Doe", "phone_number": 16511234567, "employee_code": 1234, "activated": true, "notes": "Excellent employee", "hours_max": 40, "hourly_rate": 15, "position_rates": { "1001": 2, "1002": 3.5 }, "type": 5, "employment_type": "hourly", "last_login": "2019-05-23T23:59:59+05:00", "positions": [ 1, 2, 3 ], "locations": [ 1, 2, 3 ], "is_deleted": false, "is_hidden": false, "is_payroll": false, "is_private": false, "is_trusted": false, "created_at": "2019-05-16T06:57:28+05:00", "updated_at": "2019-05-16T06:57:28+05:00", "start_date": "2019-05-16" } ] } ``` -------------------------------- ### Get Users Request Source: https://dev.wheniwork.com/ This snippet shows how to make a GET request to the /2/users endpoint using curl. It includes the necessary W-Token header for authentication. ```shell curl https://api.wheniwork.com/2/users \ -H "W-Token: ilovemyboss" ``` -------------------------------- ### Get Site Response Sample Source: https://dev.wheniwork.com/ This is a sample JSON response when retrieving a single site by its ID. It includes detailed site information. ```json { "site": { "id": 10000, "account_id": 10000, "location_id": 145030, "name": "Main venue.", "color": "8da6d9", "description": "Large meeting room", "address": "420 N 5th St #500, Minneapolis, MN 55401, USA", "coordinates": [ 44.983791, -93.2774416 ], "latitude": 44.983791, "longitude": -93.2774416, "place": { "address": "420 N 5th St #500, Minneapolis, MN 55401, USA", "business_name": "When I Work", "country": "US", "id": 2, "latitude": 44.983791, "locality": "Minneapolis", "longitude": -93.277442, "place_id": "ChIJYfRBzjfVslIRQLB018IGX3o", "place_type": [ "point_of_interest", "establishment" ], "postal_code": "55401", "region": "MN", "street_name": "N 5th St", "street_number": "420", "sub_locality": "string", "updated_at": "2019-05-16T09:14:45+05:45" }, "place_id": 2, "is_deleted": false, "deleted_at": "2019-08-24T14:15:22Z", "created_at": "2020-05-16T06:57:28+05:00", "updated_at": "2020-05-26T06:57:28+05:00" } } ``` -------------------------------- ### Fetch Shifts Source: https://dev.wheniwork.com/external/monolith/docs-master.json A basic example of how to fetch shifts using the Wheniwork API. This command retrieves all shifts without any specific filters. ```shell curl https://api.wheniwork.com/2/shifts ``` -------------------------------- ### List Payrolls Request Source: https://dev.wheniwork.com/ Example of a cURL request to list payroll periods. The W-Token is required for authorization. ```shell curl -X Get https://api.wheniwork.com/2/payrolls -H "W-Token: ilovemyboss" ``` -------------------------------- ### Create Site Source: https://dev.wheniwork.com/external/monolith/docs-master.json Create a new site within the system. ```APIDOC ## POST /api/v1/sites ### Description Create a new site. The request body should contain the site data. ### Method POST ### Endpoint /api/v1/sites ### Parameters #### Request Body - (object) - Required - The site data. Should conform to the Site schema. ### Request Example (No example provided in source) ### Response #### Success Response (200) (No specific response schema provided in source) #### Response Example (No example provided in source) ``` -------------------------------- ### Get Scheduled Shift Breaks Source: https://dev.wheniwork.com/external/monolith/docs-master.json Retrieves a list of scheduled shift breaks. Supports filtering by start time, end time, shift ID, user ID, location ID, and pagination. ```APIDOC ## GET /v3/scheduled-shift-breaks ### Description Get scheduled shift breaks. ### Method GET ### Endpoint /v3/scheduled-shift-breaks ### Parameters #### Query Parameters - **startTime** (string) - Optional - Gets shift breaks with start after (datetime formatted ISO8601) - **endTime** (string) - Optional - Gets shifts breaks with end before (datetime formatted ISO8601) - **shiftId** (string) - Optional - Comma separated list of shift ids to filter results - **userId** (string) - Optional - Comma separated list of user ids to filter results - **locationId** (string) - Optional - Comma separated list of location ids to filter results - **limit** (integer) - Optional - Limit results - **page** (integer) - Optional - Start on page ### Responses #### Success Response (200) - **data** (array) - Contains an array of ScheduledBreak objects. #### Error Response (400) - **Error** - Bad Request occurs if start/end is in an invalid format #### Error Response (401) - **Error** - Unauthorized ``` -------------------------------- ### Get Payroll Source: https://dev.wheniwork.com/external/monolith/docs-master.json Get an existing payroll period by ID. ```APIDOC ## GET /2/payrolls/{id} ### Description Get an existing payroll period by ID. ### Method GET ### Endpoint /2/payrolls/{id} ### Parameters #### Path Parameters - **id** (integer) - Required - The ID of the payroll period requested. ### Request Example ```shell curl -X Get https://api.wheniwork.com/2/payrolls/{Id} -H "W-Token: ilovemyboss" ``` ### Response #### Success Response (200) - **payroll** (object) - The payroll object. - **payrollhours** (array) - The final unchanging snapshot of hours for a closed out payroll. Broken out by type, split as needed when crossing pay periods. #### Response Example { "payroll": { "id": 1, "start_date": "2023-01-01T00:00:00Z", "end_date": "2023-01-15T00:00:00Z", "total_hours": 80, "total_cost": 1600.00 }, "payrollhours": [ { "type": "regular", "hours": 75, "cost": 1500.00 }, { "type": "overtime", "hours": 5, "cost": 100.00 } ] } ``` -------------------------------- ### Get User Profile Source: https://dev.wheniwork.com/external/monolith/docs-master.json Get the logged in user's profile. ```APIDOC ## GET /2/users/profile ### Description Get the logged in user's profile. ### Method GET ### Endpoint /2/users/profile ### Response #### Success Response (200) - **user** (object) - Contains the user profile details. ``` -------------------------------- ### List Users with cURL Source: https://dev.wheniwork.com/external/monolith/docs-master.json This snippet shows how to list all users in an account using a cURL command. Ensure you replace 'ilovemyboss' with your actual W-Token. ```shell curl https://api.wheniwork.com/2/users \ -H "W-Token: ilovemyboss" ``` -------------------------------- ### Create Site Source: https://dev.wheniwork.com/ Used to create a site within an account. Requires W-Token authorization. ```APIDOC ## Create Site Used to create a site within an account ### Method POST ### Endpoint /2/sites ### Parameters #### Request Body - **account_id** (integer) - Required - **location_id** (integer) - Required - **name** (string) - Required - **color** (string) - Optional - **description** (string) - Optional - **address** (string) - Optional - **coordinates** (Array of arrays) - Optional - **latitude** (number ) - Optional - **longitude** (number ) - Optional - **place** (object) - Optional - **place_id** (string) - Optional - **is_deleted** (boolean) - Optional - **deleted_at** (string ) - Optional - **created_at** (string ) - Optional - **updated_at** (string ) - Optional ### Request Example ```json { "account_id": 10000, "location_id": 145030, "name": "Main venue.", "color": "8da6d9", "description": "Large meeting room", "address": "420 N 5th St #500, Minneapolis, MN 55401, USA", "coordinates": [ 44.983791, -93.2774416 ], "latitude": 44.983791, "longitude": -93.2774416, "place": { "address": "420 N 5th St #500, Minneapolis, MN 55401, USA", "business_name": "When I Work", "country": "US", "id": 2, "latitude": 44.983791, "locality": "Minneapolis", "longitude": -93.277442, "place_id": "ChIJyfRBzjfVslIRQLB018IGX3o", "place_type": [ "point_of_interest", "establishment" ], "postal_code": "55401", "region": "MN", "street_name": "N 5th St", "street_number": "420", "sub_locality": "string", "updated_at": "2019-05-16T09:14:45+05:45" }, "place_id": 2, "is_deleted": false, "deleted_at": "2019-08-24T14:15:22Z", "created_at": "2020-05-16T06:57:28+05:00", "updated_at": "2020-05-26T06:57:28+05:00" } ``` ### Responses #### Success Response (200) Valid ```json { "type": null, "properties": null } ``` ``` -------------------------------- ### Get Availability Event Source: https://dev.wheniwork.com/external/monolith/docs-master.json Get a single availability event by ID ```APIDOC ## GET /2/availabilityevents/{id} ### Description Get a single availability event by ID ### Method GET ### Endpoint /2/availabilityevents/{id} #### Path Parameters - **id** (integer) - Required - The ID of the event ### Response #### Success Response (200) - **availabilityevent** (object) - Description ``` -------------------------------- ### Example JSON Payload for Messages Source: https://dev.wheniwork.com/ This is an example JSON payload structure for messages, detailing fields like account_id, content, and timestamps. ```json { "messages": [ { "account_id": 0, "actor": 0, "content": "string", "conversation_id": 0, "created_at": "2019-08-24T14:15:22Z", "id": 0, "request_id": 0, "swap_id": 0, "title": "string", "updated_at": "2019-08-24T14:15:22Z", "user_id": 0 } ], "request": { "id": 0, "account_id": 0, "created_at": "2019-08-24T14:15:22Z", "creator_id": 0, "end_time": "2019-08-24T14:15:22Z", "hours": 0.1, "status": 0, "start_time": "2019-08-24T14:15:22Z", "type": 0, "type_id": 0, "type_label": "string", "paid": true, "updated_at": "2019-08-24T14:15:22Z", "user_id": 0, "can_edit": false, "user_status": 0 }, "users": [ { "account_id": 0, "activated": true, "email": "user@example.com", "employee_code": "string", "first_name": "string", "hourly_rate": 0.1, "hours_max": 0.1, "hours_preferred": 0.1, "id": 0, "is_deleted": true, "is_hidden": true, "is_payroll": true, "is_private": true, "is_trusted": true, "last_login": "2019-08-24T14:15:22Z", "last_name": "string", "locations": [ 0 ], "login_id": 0, "notes": "string", "phone_number": "string", "positions": [ 0 ], "role": "1 = Admin", "type": 0 } ] } ``` -------------------------------- ### Site Response Sample Source: https://dev.wheniwork.com/ This is a sample JSON response for a site object, detailing its properties and structure. ```json { "sites": [ { "id": 10000, "account_id": 10000, "location_id": 145030, "name": "Main venue.", "color": "8da6d9", "description": "Large meeting room", "address": "420 N 5th St #500, Minneapolis, MN 55401, USA", "coordinates": [ 44.983791, -93.2774416 ], "latitude": 44.983791, "longitude": -93.2774416, "place": { "address": "420 N 5th St #500, Minneapolis, MN 55401, USA", "business_name": "When I Work", "country": "US", "id": 2, "latitude": 44.983791, "locality": "Minneapolis", "longitude": -93.277442, "place_id": "ChIJYfRBzjfVslIRQLB018IGX3o", "place_type": [ "point_of_interest", "establishment" ], "postal_code": "55401", "region": "MN", "street_name": "N 5th St", "street_number": "420", "sub_locality": "string", "updated_at": "2019-05-16T09:14:45+05:45" }, "place_id": 2, "is_deleted": false, "deleted_at": "2019-08-24T14:15:22Z", "created_at": "2020-05-16T06:57:28+05:00", "updated_at": "2020-05-26T06:57:28+05:00" } ] } ``` -------------------------------- ### Updated Account Settings Response Sample Source: https://dev.wheniwork.com/ This sample response reflects the updated account settings after a successful modification. It mirrors the structure of the initial account settings response. ```json { "id": 10000, "master_id": 0, "type": 1, "logo": "https://s3.amazonaws.com/path/to/logo.jpg", "company": "When I Work", "subdomain": "wheniwork", "enabled": true, "bad_credit_card": false, "plan_expires": "2021-01-06T10:55:58-06:00", "features": [ "attendance", "openshifts", "annotations" ], "timezone_id": 11, "timezone_name": "America/Chicago", "settings": "string", "place": { "business_name": "When I Work", "address": "420 N 5th St, Minneapolis, MN 55401, USA", "place_id": "ChIJc9x2LYwys1IReiu9JB3DLGY", "place_type": "premise", "latitude": 44.98364, "longitude": -93.277486 }, "created_at": "2019-05-16T06:57:28+05:00", "updated_at": "2019-05-16T06:57:28+05:00" } ``` -------------------------------- ### Get Position Source: https://dev.wheniwork.com/external/monolith/docs-master.json Retrieves a single position by its ID. ```APIDOC ## GET /2/positions/{id} ### Description Get a single position by ID ### Method GET ### Endpoint /2/positions/{id} ### Parameters #### Path Parameters - **id** (integer) - Required - The ID of the position ### Response #### Success Response (200) - **position** (object) - The requested position object ### Request Example ```json { "example": "GET /2/positions/1" } ``` ### Response Example ```json { "example": { "position": { "id": 1, "name": "Manager", "location_id": 1, "created_at": "2023-01-01T12:00:00Z", "updated_at": "2023-01-01T12:00:00Z" } } } ``` ``` -------------------------------- ### Get Site Source: https://dev.wheniwork.com/external/monolith/docs-master.json Retrieves a single site by its unique identifier. ```APIDOC ## GET /2/sites/{id} ### Description Get a single site by ID ### Method GET ### Endpoint /2/sites/{id} ### Parameters #### Path Parameters - **id** (integer) - Required - The ID of the site ### Response #### Success Response (200) - **site** (object) - Contains site details ``` -------------------------------- ### Create Account Source: https://dev.wheniwork.com/ Used to create an account. Requires W-Token authorization. The request body should contain account data including logo, subdomain, settings, place details, and an optional referral reason. ```APIDOC ## POST /2/account ### Description Used to create an account. ### Method POST ### Endpoint https://api.wheniwork.com/2/account ### Parameters #### Request Body - **logo** (string) - Path to the image file for the company's logo. - **subdomain** (string) - Deprecated. Subdomain of wheniwork.com to access company-specific When I Work web application. No longer used. - **settings** (string) - A list of settings for this account. - **place** (object) - Place details. - **referral_reason** (string) - Optional. Referral reason, which will persist as the referral_code. ### Request Example ```json { "logo": "https://s3.amazonaws.com/path/to/logo.jpg", "subdomain": "wheniwork", "settings": "string", "place": { "business_name": "When I Work", "address": "420 N 5th St, Minneapolis, MN 55401, USA", "place_id": "ChIJc9x2LYwys1IReiu9JB3DLGY", "place_type": "premise", "latitude": 44.98364, "longitude": -93.277486 }, "referral_reason": "goog" } ``` ### Response #### Success Response (200) - **success** (boolean) - **account** (object) - **id** (integer) - **master_id** (integer) - **type** (integer) - **logo** (string) - **company** (string) - **subdomain** (string) - **enabled** (boolean) - **bad_credit_card** (boolean) - **plan_expires** (string) - **features** (array of strings) - **timezone_id** (integer) - **timezone_name** (string) - **settings** (string) - **place** (object) - **business_name** (string) - **address** (string) - **place_id** (string) - **place_type** (string) - **latitude** (number) - **longitude** (number) - **created_at** (string) - **updated_at** (string) #### Response Example ```json { "success": true, "account": { "id": 10000, "master_id": 0, "type": 1, "logo": "https://s3.amazonaws.com/path/to/logo.jpg", "company": "When I Work", "subdomain": "wheniwork", "enabled": true, "bad_credit_card": false, "plan_expires": "2021-01-06T10:55:58-06:00", "features": [ "attendance", "openshifts", "annotations" ], "timezone_id": 11, "timezone_name": "America/Chicago", "settings": "string", "place": { "business_name": "When I Work", "address": "420 N 5th St, Minneapolis, MN 55401, USA", "place_id": "ChIJc9x2LYwys1IReiu9JB3DLGY", "place_type": "premise", "latitude": 44.98364, "longitude": -93.277486 }, "created_at": "2019-05-16T06:57:28+05:00", "updated_at": "2019-05-16T06:57:28+05:00" } } ``` ``` -------------------------------- ### Get shift history Source: https://dev.wheniwork.com/external/monolith/docs-master.json Retrieves the history of a specific shift. ```APIDOC ## GET /2/shifts/{id}/history ### Description Retrieves the history of a specific shift. ### Method GET ### Endpoint /2/shifts/{id}/history ### Parameters #### Path Parameters - **id** (integer) - Required - The ID of the shift #### Query Parameters - **include_deleted** (boolean) - Optional - Flag to indicate if you want to search for a deleted shift's history (off by default). ``` -------------------------------- ### Create Annotation Response Sample Source: https://dev.wheniwork.com/ Sample response after successfully creating an annotation. Includes the details of the newly created annotation, such as its ID and associated properties. ```json { "annotation": { "id": 10000, "account_id": 10000, "all_locations": false, "announcement": false, "business_closed": true, "color": "cccccc", "creator_id": 1000, "end_date": "2019-05-23T23:59:59+05:00", "locations": [ null ], "message": "asdf", "no_time_off": false, "start_date": "2019-05-23T00:00:00+05:00", "title": "Example Annotation", "relevant_at": "2019-05-09T00:00:00+05:45", "created_at": "2019-05-16T06:57:28+05:00", "updated_at": "2019-05-16T06:57:28+05:00" } } ``` -------------------------------- ### Get Payroll by ID Source: https://dev.wheniwork.com/ Retrieves a specific payroll by its unique identifier. ```APIDOC ## Get Payroll by ID ### Description Retrieves a specific payroll by its unique identifier. ### Method GET ### Endpoint /2/payrolls/{Id} ### Request Example ```shell curl -X Get https://api.wheniwork.com/2/payrolls/{Id} -H "W-Token: ilovemyboss" ``` ### Response #### Success Response (200) ```json { "payroll": { "id": 100000, "account_id": 100000, "creator_id": 1000000, "start_date": "Sun, 16 May 2021 00:00:00 -0500", "end_date": "Sat, 29 May 2021 23:59:59 -0500", "offset": "00:00:00", "notes": "Holiday payroll run.", "is_edited": false, "is_closed": false, "closed_at": "Sun, 16 May 2021 00:00:00 -0500", "is_finalized": false, "finalized_at": "Sun, 16 May 2021 00:00:00 -0500", "created_at": "Mon, 03 May 2021 09:35:38 -0500", "updated_at": "Thu, 10 Jun 2021 10:19:47 -0500" }, "payrollhours": [ { "id": 0, "payroll_id": 0, "type": 0, "type_label": "string", "user_id": 0, "position_id": 0, "hours": 0.1, "rate": 0.1, "total": 0.1 } ] } ``` ``` -------------------------------- ### Fetch User Listing with Token Source: https://dev.wheniwork.com/external/monolith/docs-master.json After obtaining a token, use this cURL command to fetch a list of users associated with your account. The token can be passed in the Authorization header. ```bash curl -X GET \ 'https://api.wheniwork.com/2/login?show_pending=true' \ -H 'Host: api.wheniwork.com' \ -H 'Authorization: Bearer ' ``` -------------------------------- ### Get Shift Break Source: https://dev.wheniwork.com/external/monolith/docs-master.json Retrieves a specific shift break by its ID. ```APIDOC ## GET /v3/shift-breaks/{id} ### Description Get a single shift break by its ID. ### Method GET ### Endpoint /v3/shift-breaks/{id} ### Parameters #### Path Parameters - **id** (integer) - Required - The ID of the shift break to retrieve. ### Response #### Success Response (200) - **data** (object) - Contains the requested ShiftBreak object. #### Response Example { "data": { "id": 1, "shift_id": 10, "break_type_id": 5, "starts_at": "2023-10-27T10:00:00Z", "ends_at": "2023-10-27T10:30:00Z" } } #### Error Response (401) - **error** (object) - Indicates an unauthorized request. #### Error Response (403) - **error** (object) - Indicates a forbidden request. #### Error Response (404) - **error** (object) - Indicates that the requested shift break was not found. ``` -------------------------------- ### Create User Source: https://dev.wheniwork.com/external/monolith/docs-master.json Used to create a user. ```APIDOC ## POST /2/users ### Description Used to create a user ### Method POST ### Endpoint /2/users ``` -------------------------------- ### Response Sample for Batch User Creation Source: https://dev.wheniwork.com/ A sample JSON response indicating the result of a batch user creation request. In this case, 'user' is null, which might signify a successful but empty operation or a placeholder. ```json { "user": null } ``` -------------------------------- ### Get Annotation Source: https://dev.wheniwork.com/external/monolith/docs-master.json Retrieves a single shift annotation by its unique ID. ```APIDOC ## GET /2/annotations/{id} ### Description Get a single shift annotation by ID. ### Method GET ### Endpoint /2/annotations/{id} ### Parameters #### Path Parameters - **id** (integer) - Required - The ID of the annotation. ### Response #### Success Response (200) - **annotation** (object) - The requested annotation object. ### Response Example { "annotation": { "id": 1, "location_id": 1, "description": "Company holiday", "start_date": "2024-12-25T00:00:00+00:00", "end_date": "2024-12-25T00:00:00+00:00", "type": "holiday", "allow_time_off": false } } ``` -------------------------------- ### Get Schedule (Location) Source: https://dev.wheniwork.com/external/monolith/docs-master.json Retrieves a single schedule/location by its unique ID. ```APIDOC ## GET /2/locations/{id} ### Description Get a single schedule/location by ID. ### Method GET ### Endpoint /2/locations/{id} ### Parameters #### Path Parameters - **id** (integer) - Required - The ID of the schedule ### Response #### Success Response (200) - **location** (object) - The requested schedule/location object. ### Response Example { "location": { "id": 1, "name": "Store 1", "address": "123 Main St", "city": "Anytown", "state": "CA", "zip_code": "90210", "country": "USA", "phone_number": "555-123-4567", "time_zone": "America/Los_Angeles", "latitude": 34.0522, "longitude": -118.2437, "created_at": "2023-01-01T12:00:00Z", "updated_at": "2023-01-01T12:00:00Z" } } ``` -------------------------------- ### Get Time Source: https://dev.wheniwork.com/external/monolith/docs-master.json Retrieve a single time entry by its unique ID. ```APIDOC ## GET /2/times/{id} ### Description Get a single time by ID. ### Method GET ### Endpoint /2/times/{id} ### Parameters #### Path Parameters - **id** (integer) - Required - The ID of the time. ### Response #### Success Response (200) - **time** (object) - The requested Time object. ### Response Example { "time": { "example": "Time object example" } } ``` -------------------------------- ### Account Response Sample Source: https://dev.wheniwork.com/ This is a sample JSON response for a successful account retrieval or creation. It includes details about the account, company information, and location. ```json { "account": { "id": 10000, "master_id": 0, "type": 1, "logo": "https://s3.amazonaws.com/path/to/logo.jpg", "company": "When I Work", "subdomain": "wheniwork", "enabled": true, "bad_credit_card": false, "plan_expires": "2021-01-06T10:55:58-06:00", "features": [ "attendance", "openshifts", "annotations" ], "timezone_id": 11, "timezone_name": "America/Chicago", "settings": "string", "place": { "business_name": "When I Work", "address": "420 N 5th St, Minneapolis, MN 55401, USA", "place_id": "ChIJc9x2LYwys1IReiu9JB3DLGY", "place_type": "premise", "latitude": 44.98364, "longitude": -93.277486 }, "created_at": "2019-05-16T06:57:28+05:00", "updated_at": "2019-05-16T06:57:28+05:00" } } ``` -------------------------------- ### Get Position Source: https://dev.wheniwork.com/ Retrieves a single position by its ID. Requires W-Token authorization. ```APIDOC ## Get Position Get a single position by ID ### Description Retrieves a single position by its ID. ### Method GET ### Endpoint /2/positions/{id} ### Parameters #### Path Parameters - **id** (integer) - Required - The ID of the position ### Responses #### Success Response (200) Valid response containing position details. ### Response Example ```json { "position": { "id": 10000, "account_id": 10000, "name": "Dishwasher", "color": "cc0000", "sort": 2, "tips_tracking": true, "created_at": "Thu, 06 Mar 2016 21:12:14 -0600", "updated_at": "Thu, 06 Mar 2016 22:17:14 -0600" } } ``` ``` -------------------------------- ### Get User Source: https://dev.wheniwork.com/external/monolith/docs-master.json Retrieves a single user's information by their unique ID. ```APIDOC ## GET /2/users/{id} ### Description Get a single user by ID ### Method GET ### Endpoint /2/users/{id} ### Parameters #### Path Parameters - **id** (integer) - Required - The ID of the user ### Request Example ```shell curl https://api.wheniwork.com/2/users/4364 \ -H "W-Token: ilovemyboss" ``` ### Response #### Success Response (200) - **user** (object) - Description of the user object #### Response Example { "user": { "example": "user object" } } ``` -------------------------------- ### Create Location Response Sample Source: https://dev.wheniwork.com/ This is a sample JSON response for a successful location creation. It includes the newly created location's ID and all its details. ```json { "location": { "id": 10000, "account_id": 10000, "name": "Front of House", "address": "420 N 5th St #500, Minneapolis, MN 55401, USA", "coordinates": [ 44.983791, -93.2774416 ], "deleted_at": "2019-08-24T14:15:22Z", "ip_address": "192.168.1.1", "is_default": false, "is_deleted": false, "latitude": 44.983791, "longitude": -93.2774416, "max_hours": 0, "place": { "address": "420 N 5th St #500, Minneapolis, MN 55401, USA", "business_name": "When I Work", "country": "US", "id": 2, "latitude": 44.983791, "locality": "Minneapolis", "longitude": -93.277442, "place_id": "ChIJYfRBzjfVslIRQLB018IGX3o", "place_type": [ "point_of_interest", "establishment" ], "postal_code": "55401", "region": "MN", "street_name": "N 5th St", "street_number": "420", "sub_locality": "string", "updated_at": "2019-05-16T09:14:45+05:45" }, "place_confirmed": true, "place_id": 2, "radius": 100, "sort": 0, "created_at": "2019-05-16T06:57:28+05:00", "updated_at": "2019-05-16T06:57:28+05:00" } } ``` -------------------------------- ### Get Shift Template (Block) Source: https://dev.wheniwork.com/external/monolith/docs-master.json Retrieves a single shift template by its ID. ```APIDOC ## GET /websites/dev_wheniwork/templates/{id} ### Description Get a single shift template by ID. ### Method GET ### Endpoint /websites/dev_wheniwork/templates/{id} ### Parameters #### Path Parameters - **id** (integer) - Required - The ID of the shift template ### Response #### Success Response (200) - **block** (ShiftTemplate) - Description of the shift template object ``` -------------------------------- ### User Data Response Sample Source: https://dev.wheniwork.com/ This is a sample JSON response for user data, detailing various user attributes. ```json { "users": [ { "account_id": 0, "activated": true, "email": "user@example.com", "employee_code": "string", "first_name": "string", "hourly_rate": 0.1, "hours_max": 0.1, "hours_preferred": 0.1, "id": 0, "is_deleted": true, "is_hidden": true, "is_payroll": true, "is_private": true, "is_trusted": true, "last_login": "2019-08-24T14:15:22Z", "last_name": "string", "locations": [ 0 ], "login_id": 0, "notes": "string", "phone_number": "string", "positions": [ 0 ], "role": "1 = Admin", "type": 0 } ] } ``` -------------------------------- ### Get Payroll Statistics for current hours Source: https://dev.wheniwork.com/ Retrieves the aggregate statistics for a payroll period by its ID. ```APIDOC ## Get Payroll Statistics for current hours ### Description Get the aggregate statistics for payroll period by ID ### Method GET ### Endpoint /2/payrolls/{id}/stats ### Parameters #### Path Parameters - **id** (integer) - Required - The ID of the payroll period requested. #### Query Parameters - **mapObjects** (boolean) - Optional - Force structured listings to use maps by ID and not arrays ### Request Example ```shell curl -X Get https://api.wheniwork.com/2/payrolls/{Id}/Stats -H "W-Token: ilovemyboss" ``` ``` -------------------------------- ### Create Site Request Payload Source: https://dev.wheniwork.com/ This is a sample JSON payload for creating a new site. Ensure all required fields are included. ```json { "account_id": 10000, "location_id": 145030, "name": "Main venue.", "color": "8da6d9", "description": "Large meeting room", "address": "420 N 5th St #500, Minneapolis, MN 55401, USA", "coordinates": [ 44.983791, -93.2774416 ], "latitude": 44.983791, "longitude": -93.2774416, "place": { "address": "420 N 5th St #500, Minneapolis, MN 55401, USA", "business_name": "When I Work", "country": "US", "id": 2, "latitude": 44.983791, "locality": "Minneapolis", "longitude": -93.277442, "place_id": "ChIJYfRBzjfVslIRQLB018IGX3o", "place_type": [ "point_of_interest", "establishment" ], "postal_code": "55401", "region": "MN", "street_name": "N 5th St", "street_number": "420", "sub_locality": "string", "updated_at": "2019-05-16T09:14:45+05:45" }, "place_id": 2, "is_deleted": false, "deleted_at": "2019-08-24T14:15:22Z", "created_at": "2020-05-16T06:57:28+05:00", "updated_at": "2020-05-26T06:57:28+05:00" } ``` -------------------------------- ### Fetch Users with User ID Context Source: https://dev.wheniwork.com/external/monolith/docs-master.json To act on behalf of a specific user account, include the user ID in the 'W-UserId' header along with your authorization token. ```bash curl -X GET \ https://api.wheniwork.com/2/users \ -H 'Authorization: Bearer ' \ -H 'W-UserId: ' ``` -------------------------------- ### Get specific OpenShift Approval Request Source: https://dev.wheniwork.com/external/monolith/docs-master.json Retrieves a specific OpenShift Approval Request by its ID. ```APIDOC ## GET /2/openshiftapprovalrequests/{request_id} ### Description Retrieves a specific OpenShift Approval Request by its ID. ### Method GET ### Endpoint /2/openshiftapprovalrequests/{request_id} ### Parameters #### Path Parameters - **request_id** (integer) - Required - OpenShift Approval Request ID to return. ### Response #### Success Response (200) - **openshiftapprovalrequest** (object) - Contains the OpenShift Approval Request details. ``` -------------------------------- ### RequestHourStats Object Source: https://dev.wheniwork.com/external/monolith/docs-master.json Represents the structure for requesting hour statistics, including start and end times. ```APIDOC ## RequestHourStats Object ### Description Represents the structure for requesting hour statistics, including start and end times. ### Properties - **id** (object) - Required. - **start** (object) - Required. - **end** (object) - Required. ### Required Properties - id - start - end ``` -------------------------------- ### Authenticate with Developer Key Source: https://dev.wheniwork.com/external/monolith/docs-master.json Use this cURL command to authenticate with your developer key, username, and password to obtain an authentication token. ```bash curl -X POST \ https://api.login.wheniwork.com/login \ -H 'W-Key: ' \ -H 'content-type: application/json' \ -d '{"email":"","password":""}' ```