# When I Work

> Read employees, schedules, shifts, time entries and time off; manage positions and schedules.

App · 20 actions. Web page: https://docs.lodol.com/docs/integrations/when-i-work

## Actions

### Create position

Create Position.

**Inputs**

- Name (`name`, text, required): Name.
- Color (`color`, text): Color.

**Outputs**

- `data` (object): When I Work response data.

**Example output**

```json
{
  "data": {
    "position": {
      "account_id": 1,
      "color": "example",
      "created_at": "example",
      "id": 1,
      "name": "example",
      "sort": 1,
      "tips_tracking": false,
      "updated_at": "example"
    }
  }
}
```

### Create schedule

Create Schedule (Location).

**Inputs**

- Name (`name`, text, required): Name.
- Address (`address`, text): Address.

**Outputs**

- `data` (object): When I Work response data.

**Example output**

```json
{
  "data": {
    "location": {
      "account_id": 1,
      "address": "example",
      "coordinates": [],
      "created_at": "example",
      "deleted_at": "example",
      "id": 1,
      "ip_address": "example",
      "is_default": false,
      "is_deleted": false,
      "latitude": 1.0,
      "longitude": 1.0,
      "max_hours": 1,
      "name": "example",
      "place": {
        "address": "example",
        "business_name": "example",
        "country": "example",
        "id": 1,
        "latitude": 1.0,
        "locality": "example",
        "longitude": 1.0,
        "place_id": "example",
        "place_type": [],
        "postal_code": "example",
        "region": "example",
        "street_name": "example",
        "street_number": "example",
        "sub_locality": "example",
        "updated_at": "example"
      },
      "place_confirmed": false,
      "place_id": "example",
      "radius": 1,
      "sort": 1,
      "updated_at": "example"
    }
  }
}
```

### Delete position

Delete Position.

**Inputs**

- Id (`id`, text, required): The ID of the position

**Outputs**

- `data` (object): When I Work response data.

**Example output**

```json
{
  "data": {
    "success": false
  }
}
```

### Delete schedule

Delete Schedule (Location).

**Inputs**

- Id (`id`, text, required): The ID of the schedule

**Outputs**

- `data` (object): When I Work response data.

**Example output**

```json
{
  "data": {
    "success": false
  }
}
```

### Get position

Get Position.

**Inputs**

- Id (`id`, text, required): The ID of the position

**Outputs**

- `data` (object): When I Work response data.

**Example output**

```json
{
  "data": {
    "position": {
      "account_id": 1,
      "color": "example",
      "created_at": "example",
      "id": 1,
      "name": "example",
      "sort": 1,
      "tips_tracking": false,
      "updated_at": "example"
    }
  }
}
```

### Get profile

Get User Profile.

**Inputs**: None.

**Outputs**

- `data` (object): When I Work response data.

**Example output**

```json
{
  "data": {
    "user": {
      "account_id": 1,
      "activated": false,
      "created_at": "example",
      "email": "example",
      "employee_code": "example",
      "employment_type": "hourly",
      "first_name": "example",
      "hourly_rate": 1.0,
      "hours_max": 1.0,
      "id": 1,
      "is_deleted": false,
      "is_hidden": false,
      "is_payroll": false,
      "is_private": false,
      "is_trusted": false,
      "last_login": "example",
      "last_name": "example",
      "locations": [],
      "login_id": 1,
      "middle_name": "example",
      "notes": "example",
      "phone_number": "example",
      "position_rates": {},
      "positions": [],
      "role": 1,
      "start_date": "example",
      "type": 1,
      "updated_at": "example"
    }
  }
}
```

### Get schedule

Get Schedule (Location).

**Inputs**

- Id (`id`, text, required): The ID of the schedule

**Outputs**

- `data` (object): When I Work response data.

**Example output**

```json
{
  "data": {
    "location": {
      "account_id": 1,
      "address": "example",
      "coordinates": [],
      "created_at": "example",
      "deleted_at": "example",
      "id": 1,
      "ip_address": "example",
      "is_default": false,
      "is_deleted": false,
      "latitude": 1.0,
      "longitude": 1.0,
      "max_hours": 1,
      "name": "example",
      "place": {
        "address": "example",
        "business_name": "example",
        "country": "example",
        "id": 1,
        "latitude": 1.0,
        "locality": "example",
        "longitude": 1.0,
        "place_id": "example",
        "place_type": [],
        "postal_code": "example",
        "region": "example",
        "street_name": "example",
        "street_number": "example",
        "sub_locality": "example",
        "updated_at": "example"
      },
      "place_confirmed": false,
      "place_id": "example",
      "radius": 1,
      "sort": 1,
      "updated_at": "example"
    }
  }
}
```

### Get shift

Get Shift.

**Inputs**

- Id (`id`, text, required): The ID of the shift

**Outputs**

- `data` (object): When I Work response data.

**Example output**

```json
{
  "data": {
    "repeating_shifts": [],
    "shift": {
      "account_id": 1,
      "acknowledged": false,
      "acknowledged_at": "example",
      "alerted": false,
      "break_time": 1.0,
      "breaks": [],
      "color": "example",
      "created_at": "example",
      "creator_id": 1,
      "end_time": "example",
      "id": 1,
      "instances": 1,
      "is_approved_without_time": false,
      "is_open": false,
      "is_shared": false,
      "is_trimmed": false,
      "linked_users": [],
      "location_id": 1,
      "notes": "example",
      "notified_at": "example",
      "openshift_approval_request_id": 1,
      "position_id": 1,
      "published": false,
      "published_date": "example",
      "requires_openshift_approval": false,
      "shiftchain_key": "example",
      "site_id": 1,
      "start_time": "example",
      "updated_at": "example",
      "user_id": 1
    },
    "shiftchains": []
  }
}
```

### Get site

Get Site.

**Inputs**

- Id (`id`, text, required): The ID of the site

**Outputs**

- `data` (object): When I Work response data.

**Example output**

```json
{
  "data": {
    "site": {
      "account_id": 1,
      "address": "example",
      "color": "example",
      "coordinates": [],
      "created_at": "example",
      "deleted_at": "example",
      "description": "example",
      "id": 1,
      "is_deleted": false,
      "latitude": 1.0,
      "location_id": 1,
      "longitude": 1.0,
      "name": "example",
      "place": {
        "address": "example",
        "business_name": "example",
        "country": "example",
        "id": 1,
        "latitude": 1.0,
        "locality": "example",
        "longitude": 1.0,
        "place_id": "example",
        "place_type": [],
        "postal_code": "example",
        "region": "example",
        "street_name": "example",
        "street_number": "example",
        "sub_locality": "example",
        "updated_at": "example"
      },
      "place_id": "example",
      "updated_at": "example"
    }
  }
}
```

### Get time entry

Get Time.

**Inputs**

- Id (`id`, text, required): The ID of the time

**Outputs**

- `data` (object): When I Work response data.

**Example output**

```json
{
  "data": {
    "time": {
      "account_id": 1,
      "alert_type": 1,
      "cash_tips": "example",
      "created_at": "example",
      "creator_id": 1,
      "end_time": "example",
      "hourly_rate": 1.0,
      "id": 1,
      "is_alerted": false,
      "is_approved": false,
      "length": 1.0,
      "location_id": 1,
      "modified_by": 1,
      "notes": "example",
      "paid_break_note": "example",
      "position_id": 1,
      "rounded_end_time": "example",
      "rounded_length": 1.0,
      "rounded_start_time": "example",
      "shift_id": 1,
      "site_id": 1,
      "split_time": "example",
      "start_time": "example",
      "sync_hash": "example",
      "sync_id": "example",
      "updated_at": "example",
      "user_id": 1
    }
  }
}
```

### Get time off request

Get Time Off Request.

**Inputs**

- Request ID (`request_id`, text, required): Request ID to return.

**Outputs**

- `data` (object): When I Work response data.

**Example output**

```json
{
  "data": {
    "messages": [],
    "request": {
      "account_id": 1,
      "can_edit": false,
      "created_at": "example",
      "creator_id": 1,
      "end_time": "example",
      "hours": 1.0,
      "id": 1,
      "paid": false,
      "start_time": "example",
      "status": 0,
      "type": 1,
      "type_id": 1,
      "type_label": "example",
      "updated_at": "example",
      "user_id": 1,
      "user_status": 0
    },
    "users": []
  }
}
```

### Get user

Get User.

**Inputs**

- Id (`id`, text, required): The ID of the user

**Outputs**

- `data` (object): When I Work response data.

**Example output**

```json
{
  "data": {
    "user": {
      "account_id": 1,
      "activated": false,
      "created_at": "example",
      "email": "example",
      "employee_code": "example",
      "employment_type": "hourly",
      "first_name": "example",
      "hourly_rate": 1.0,
      "hours_max": 1.0,
      "id": 1,
      "is_deleted": false,
      "is_hidden": false,
      "is_payroll": false,
      "is_private": false,
      "is_trusted": false,
      "last_login": "example",
      "last_name": "example",
      "locations": [],
      "login_id": 1,
      "middle_name": "example",
      "notes": "example",
      "phone_number": "example",
      "position_rates": {},
      "positions": [],
      "role": 1,
      "start_date": "example",
      "type": 1,
      "updated_at": "example"
    }
  }
}
```

### List positions

List Positions.

**Inputs**

- Show deleted (`show_deleted`, true/false): Whether to show positions that have been deleted

**Outputs**

- `data` (object): When I Work response data.

**Example output**

```json
{
  "data": {
    "positions": []
  }
}
```

### List schedules

List Schedules (Locations).

**Inputs**

- Only unconfirmed (`only_unconfirmed`, true/false): Include only unconfirmed schedules/locations

**Outputs**

- `data` (object): When I Work response data.

**Example output**

```json
{
  "data": {
    "locations": []
  }
}
```

### List shifts

List Shifts.

**Inputs**

- Employee (`employee_id`, text): The user id to filter by
- Start (`start`, date and time): The start of the filter range.
- End (`end`, date and time): The end of the filter range.
- Location (`location_id`, list): Schedules to include.

**Outputs**

- `data` (object): When I Work response data.

**Example output**

```json
{
  "data": {
    "repeating_shifts": [],
    "shiftchains": [],
    "shifts": []
  }
}
```

### List sites

List Sites.

**Inputs**

- Include deleted (`include_deleted`, true/false): Include deleted sites

**Outputs**

- `data` (object): When I Work response data.

**Example output**

```json
{
  "data": {
    "sites": []
  }
}
```

### List time entries

List Times.

**Inputs**

- Start (`start`, date and time): The start of the filter range.
- End (`end`, date and time): The end of the filter range.
- Employee (`employee_id`, list): Employees to include.

**Outputs**

- `data` (object): When I Work response data.

**Example output**

```json
{
  "data": {
    "times": []
  }
}
```

### List time off requests

List Time Off Requests.

**Inputs**

- End (`end`, date, required): yyyy-mm-dd formatted end date for the request time-frame.
- Include deleted users (`include_deleted_users`, true/false): Return all requests including those made by deleted users.
- Limit (`limit`, number): Number of requests to load per page. From 1 to 200.
- Location (`location_id`, text): Location ID to show requests for.
- Max ID (`max_id`, text): Return all requests created before the request with the given ID.
- Page (`page`, number): Page of results to load. At least 0.
- Since ID (`since_id`, text): Return all requests created since the request with given ID.
- Sortby (`sortby`, text): Field to sort by. Can either be 'created' and sort by the created_at date in descending order, or anything else and sort by status in ascending order, then by the updated_at date in descending order. One of: `created`, `status`.
- Start (`start`, date, required): yyyy-mm-dd formatted start date for the request time-frame.
- Status (`status`, number): Only return requests with the given status. One of: `0` (Pending), `1` (Canceled), `2` (Accepted), `3` (Expired).
- Type (`type`, number): Type of request to filter by. One of: `0` (Unpaid time off), `1` (Paid time off), `2` (Sick), `3` (Holiday).
- Employee (`employee_id`, list): Employees to include.

**Outputs**

- `data` (object): When I Work response data.

**Example output**

```json
{
  "data": {
    "messages": [],
    "more": false,
    "page": 1,
    "requests": [],
    "total": 1,
    "users": []
  }
}
```

### List users

List Users.

**Inputs**

- Location (`location_id`, list): Location ID.
- Show pending (`show_pending`, true/false): Include pending users in results. Defaults to true.
- Only pending (`only_pending`, true/false): Include ONLY pending users in results. Defaults to false.
- Show deleted (`show_deleted`, true/false): Include deleted users in results. Defaults to false. Requires administrator, manager, or supervisor access (enforced via can_supervise()); otherwise the request returns 403.
- Only deleted (`only_deleted`, true/false): Only include deleted/archived users in results. Defaults to false. Requires administrator, manager, or supervisor access (enforced via can_supervise()); otherwise the request returns 403.
- Search (`search`, text): Optional string to search by in users first name, last name, or email.

**Outputs**

- `data` (object): When I Work response data.

**Example output**

```json
{
  "data": {
    "users": []
  }
}
```

### Update position

Update Position.

**Inputs**

- Id (`id`, text, required): The ID of the position
- Name (`name`, text): Name.
- Color (`color`, text): Color.

**Outputs**

- `data` (object): When I Work response data.

**Example output**

```json
{
  "data": {
    "position": {
      "account_id": 1,
      "color": "example",
      "created_at": "example",
      "id": 1,
      "name": "example",
      "sort": 1,
      "tips_tracking": false,
      "updated_at": "example"
    }
  }
}
```
