# Operations (sample payloads)

## Main operations

### Add employee

Add employee.
**Sample Input**
**Sample Output**

```json
\{
    "id": "12345",
    "location": "https://api.bamboohr.com/api/gateway.php/companyname/v1/employees/12345"
\}
```

### Add row to employee table

Add row to employee table.
**Sample Input**
**Sample Output**

### Add time off request

Add time off request using employee ID.
**Sample Input**
**Sample Output**

```json
{
    "id": "1001",
    "employeeId": "12345",
    "start": "2023-10-01",
    "end": "2023-10-02",
    "created": "2023-09-15T14:30:00Z",
    "status": \{
        "status": "requested",
        "lastChanged": "2023-09-15T14:30:00Z",
        "lastChangedByUserId": "12345"
    \},
    "name": "Vacation",
    "type": \{
        "id": "1",
        "name": "Vacation"
    \},
    "amount": \{
        "unit": "hours",
        "amount": "16"
    \},
    "notes": \{
        "employee": "Taking a short vacation",
        "manager": ""
    \},
    "dates": \{
        "2023-10-01": "8",
        "2023-10-02": "8"
    \},
    "comments": [
        \{
            "employeeId": "12345",
            "comment": "Submitted time off request",
            "commentDate": "2023-09-15T14:30:00Z",
            "commenterName": "John Doe"
        \}
    ],
    "actions": \{
        "view": true,
        "edit": true,
        "cancel": true,
        "approve": false,
        "deny": false,
        "bypass": false
    \},
    "policyType": "accrual",
    "usedYearToDate": 24,
    "balanceOnDateOfRequest": 80
}
```

### Change request status

Change the status of a request by request ID.
**Sample Input**
**Sample Output**

### Get an employee file by ID

Get an employee file.
**Sample Input**

```json
\{
    "employee_id": 12345,
    "file_id": 67890
\}
```

**Sample Output**

### Get company file by ID

Get a company file.
**Sample Input**

```json
{
    "file_id": "12345"
}
```

**Sample Output**

```json
{
    "file": \{
        "url": "https://companyfiles.bamboohr.com/employees/12345/document.pdf",
        "mime_type": "application/pdf",
        "expires": 1623456789
    \}
}
```

### Get details for list fields

Get details for list fields.
**Sample Input**

```json
{}
```

**Sample Output**

```json
{
    "results": [
        {
            "fieldId": 1,
            "manageable": "yes",
            "multiple": "no",
            "name": "Department",
            "options": [
                \{
                    "id": 101,
                    "archived": "no",
                    "createdDate": "2023-01-15",
                    "archivedDate": null,
                    "name": "Marketing"
                \},
                \{
                    "id": 102,
                    "archived": "no",
                    "createdDate": "2023-01-15",
                    "archivedDate": null,
                    "name": "Sales"
                \}
            ],
            "alias": "department"
        },
        {
            "fieldId": 2,
            "manageable": "yes",
            "multiple": "yes",
            "name": "Skills",
            "options": [
                \{
                    "id": 201,
                    "archived": "no",
                    "createdDate": "2023-02-01",
                    "archivedDate": null,
                    "name": "JavaScript"
                \},
                \{
                    "id": 202,
                    "archived": "no",
                    "createdDate": "2023-02-01",
                    "archivedDate": null,
                    "name": "Python"
                \}
            ],
            "alias": "skills"
        }
    ]
}
```

### Get employee by ID

Get employee by ID.
**Sample Input**

```json
\{
    "employee_id": "12345",
    "fields": [
        "firstName",
        "lastName",
        "jobTitle",
        "department",
        "workEmail"
    ],
    "only_current": true
\}
```

**Sample Output**

```json
\{
    "id": "12345",
    "firstName": "John",
    "lastName": "Doe",
    "jobTitle": "Software Engineer",
    "department": "Engineering",
    "workEmail": "john.doe@example.com"
\}
```

### Get employee directory

Get employee directory.
**Sample Input**

```json
{}
```

**Sample Output**

### Get employee table

Get table rows by employee ID and table name.
**Sample Input**

```json
\{
    "employee_id": "12345",
    "table_name": "emergencyContacts"
\}
```

**Sample Output**

```json
{
    "results": [
        \{
            "id": "1",
            "employeeId": "12345",
            "name": "John Doe",
            "relationship": "Spouse",
            "homePhone": "555-123-4567",
            "addressLine1": "123 Main St",
            "addressLine2": "Apt 4B",
            "mobilePhone": "555-987-6543",
            "email": "johndoe@example.com",
            "zipcode": "12345",
            "city": "Anytown",
            "state": "CA",
            "country": "USA",
            "workPhone": 5551112222,
            "workPhoneExtension": "123",
            "primaryContact": "Yes"
        \},
        \{
            "id": "2",
            "employeeId": "12345",
            "name": "Jane Smith",
            "relationship": "Sister",
            "homePhone": "555-234-5678",
            "addressLine1": "456 Elm St",
            "addressLine2": "",
            "mobilePhone": "555-876-5432",
            "email": "janesmith@example.com",
            "zipcode": "67890",
            "city": "Othertown",
            "state": "NY",
            "country": "USA",
            "workPhone": 5553334444,
            "workPhoneExtension": "",
            "primaryContact": "No"
        \}
    ]
}
```

### Get time off requests

Get time off requests.
**Sample Input**

```json
\{
    "start_date": "2023-01-01",
    "end_date": "2023-12-31",
    "employee_id": "1234",
    "action": "view",
    "status": "approved"
\}
```

**Sample Output**

### Get whos out

Get whos out.
**Sample Input**

```json
\{
    "start_date": "2023-05-01T00:00:00Z",
    "end_date": "2023-05-31T23:59:59Z"
\}
```

**Sample Output**

```json
{
    "results": [
        \{
            "id": 1234,
            "type": "vacation",
            "employeeId": 5678,
            "name": "John Doe",
            "start": "2023-05-15T00:00:00Z",
            "end": "2023-05-19T23:59:59Z"
        \},
        \{
            "id": 2345,
            "type": "sick",
            "employeeId": 6789,
            "name": "Jane Smith",
            "start": "2023-05-22T00:00:00Z",
            "end": "2023-05-22T23:59:59Z"
        \},
        \{
            "id": 3456,
            "type": "personal",
            "employeeId": 7890,
            "name": "Bob Johnson",
            "start": "2023-05-25T00:00:00Z",
            "end": "2023-05-26T23:59:59Z"
        \}
    ]
}
```

### List company files and categories

Get company files and categories.
**Sample Input**

```json
{}
```

**Sample Output**

```json
{
    "categories": [
        {
            "id": 1,
            "canUploadFiles": "yes",
            "name": "Employee Handbooks",
            "files": [
                \{
                    "id": 101,
                    "name": "Company Handbook 2023",
                    "originalFileName": "Company_Handbook_2023.pdf",
                    "size": "2.5MB",
                    "dateCreated": "2023-01-15",
                    "createdBy": "John Doe",
                    "shareWithEmployees": "yes",
                    "canRenameFile": "yes",
                    "canDeleteFile": "no"
                \},
                \{
                    "id": 102,
                    "name": "Code of Conduct",
                    "originalFileName": "Code_of_Conduct.pdf",
                    "size": "1.2MB",
                    "dateCreated": "2023-02-01",
                    "createdBy": "Jane Smith",
                    "shareWithEmployees": "yes",
                    "canRenameFile": "yes",
                    "canDeleteFile": "no"
                \}
            ]
        },
        {
            "id": 2,
            "canUploadFiles": "yes",
            "name": "Company Policies",
            "files": [
                \{
                    "id": 201,
                    "name": "Remote Work Policy",
                    "originalFileName": "Remote_Work_Policy.docx",
                    "size": "500KB",
                    "dateCreated": "2023-03-10",
                    "createdBy": "HR Department",
                    "shareWithEmployees": "yes",
                    "canRenameFile": "yes",
                    "canDeleteFile": "yes"
                \}
            ]
        }
    ]
}
```

### List employee fields

Get a list of fields.
**Sample Input**
**Sample Output**

```json
{
    "results": [
        \{
            "id": "firstName",
            "name": "First Name",
            "type": "text"
        \},
        \{
            "id": "lastName",
            "name": "Last Name",
            "type": "text"
        \},
        \{
            "id": "jobTitle",
            "name": "Job Title",
            "type": "text"
        \},
        \{
            "id": "department",
            "name": "Department",
            "type": "list"
        \},
        \{
            "id": "hireDate",
            "name": "Hire Date",
            "type": "date"
        \}
    ]
}
```

### List employee files and categories

Get employee files and categories.
**Sample Input**

```json
{
    "employee_id": "12345"
}
```

**Sample Output**

```json
{
    "employee": {
        "id": 12345
    },
    "categories": [
        {
            "id": 1,
            "name": "Personal Documents",
            "canRenameCategory": "yes",
            "canDeleteCategory": "no",
            "canUploadFiles": "yes",
            "displayIfEmpty": "no",
            "files": [
                \{
                    "id": 101,
                    "name": "Driver's License",
                    "originalFileName": "drivers_license.pdf",
                    "size": 1024000,
                    "dateCreated": "2023-05-15T10:30:00Z",
                    "createdBy": "HR Manager",
                    "shareWithEmployee": "yes",
                    "canRenameFile": "yes",
                    "canDeleteFile": "yes",
                    "canChangeShareWithEmployeeFieldValue": "yes"
                \},
                \{
                    "id": 102,
                    "name": "Passport",
                    "originalFileName": "passport.jpg",
                    "size": 2048000,
                    "dateCreated": "2023-05-16T14:45:00Z",
                    "createdBy": "Employee",
                    "shareWithEmployee": "yes",
                    "canRenameFile": "no",
                    "canDeleteFile": "no",
                    "canChangeShareWithEmployeeFieldValue": "no"
                \}
            ]
        },
        {
            "id": 2,
            "name": "Employment Documents",
            "canRenameCategory": "no",
            "canDeleteCategory": "no",
            "canUploadFiles": "yes",
            "displayIfEmpty": "yes",
            "files": [
                \{
                    "id": 201,
                    "name": "Employment Contract",
                    "originalFileName": "contract_2023.pdf",
                    "size": 3072000,
                    "dateCreated": "2023-01-02T09:00:00Z",
                    "createdBy": "HR Manager",
                    "shareWithEmployee": "yes",
                    "canRenameFile": "no",
                    "canDeleteFile": "no",
                    "canChangeShareWithEmployeeFieldValue": "no"
                \}
            ]
        }
    ]
}
```

### List tables

Get a list of tables.
**Sample Input**

```json
{}
```

**Sample Output**

```json
{
    "results": [
        {
            "alias": "employee",
            "fields": [
                \{
                    "id": 1,
                    "name": "employeeId",
                    "alias": "Employee ID",
                    "type": "integer"
                \},
                \{
                    "id": 2,
                    "name": "firstName",
                    "alias": "First Name",
                    "type": "text"
                \},
                \{
                    "id": 3,
                    "name": "lastName",
                    "alias": "Last Name",
                    "type": "text"
                \},
                \{
                    "id": 4,
                    "name": "jobTitle",
                    "alias": "Job Title",
                    "type": "text"
                \}
            ]
        },
        {
            "alias": "department",
            "fields": [
                \{
                    "id": 1,
                    "name": "departmentId",
                    "alias": "Department ID",
                    "type": "integer"
                \},
                \{
                    "id": 2,
                    "name": "departmentName",
                    "alias": "Department Name",
                    "type": "text"
                \}
            ]
        }
    ]
}
```

### List time off policies

Get time off policies.
**Sample Input**

```json
{}
```

**Sample Output**

```json
{
    "results": [
        \{
            "id": "1",
            "timeOffTypeId": "101",
            "name": "Vacation",
            "effectiveDate": "2023-01-01",
            "type": "Paid Time Off"
        \},
        \{
            "id": "2",
            "timeOffTypeId": "102",
            "name": "Sick Leave",
            "effectiveDate": "2023-01-01",
            "type": "Paid Time Off"
        \},
        \{
            "id": "3",
            "timeOffTypeId": "103",
            "name": "Personal Days",
            "effectiveDate": "2023-01-01",
            "type": "Paid Time Off"
        \},
        \{
            "id": "4",
            "timeOffTypeId": "104",
            "name": "Unpaid Leave",
            "effectiveDate": "2023-01-01",
            "type": "Unpaid Time Off"
        \}
    ]
}
```

### List time off types

Get time off types.
**Sample Input**
**Sample Output**

```json
{
    "timeOffTypes": [
        \{
            "id": "1",
            "name": "Vacation",
            "units": "days",
            "color": "#4CAF50",
            "icon": "beach_access"
        \},
        \{
            "id": "2",
            "name": "Sick Leave",
            "units": "days",
            "color": "#F44336",
            "icon": "local_hospital"
        \},
        \{
            "id": "3",
            "name": "Personal Time",
            "units": "hours",
            "color": "#2196F3",
            "icon": "person"
        \}
    ],
    "defaultHours": [
        \{
            "name": "Full-time",
            "amount": "8"
        \},
        \{
            "name": "Part-time",
            "amount": "4"
        \}
    ]
}
```

### List users

Get a list of users.
**Sample Input**

```json
{}
```

**Sample Output**

```json
{
    "2370": \{
        "id": 2370,
        "employeeId": 1001,
        "firstName": "John",
        "lastName": "Doe",
        "email": "john.doe@example.com",
        "status": "active",
        "lastLogin": "2023-05-15T09:30:45Z"
    \},
    "2371": \{
        "id": 2371,
        "employeeId": 1002,
        "firstName": "Jane",
        "lastName": "Smith",
        "email": "jane.smith@example.com",
        "status": "active",
        "lastLogin": "2023-05-14T14:22:30Z"
    \},
    "2372": \{
        "id": 2372,
        "employeeId": 1003,
        "firstName": "Michael",
        "lastName": "Johnson",
        "email": "michael.johnson@example.com",
        "status": "inactive",
        "lastLogin": "2023-05-10T11:15:20Z"
    \}
}
```

### Raw HTTP request (advanced)

Perform a raw HTTP request with some pre-configuration and processing by the connector, such as authentication.
**Sample Input**

```json
{
    "method": "GET",
    "url": {
        "endpoint": "/employees/directory"
    },
    "headers": [
        \{
            "key": "Accept",
            "value": "application/json"
        \}
    ],
    "query_parameters": [
        \{
            "key": "limit",
            "value": "50"
        \},
        \{
            "key": "department",
            "value": "Engineering"
        \}
    ],
    "body": {
        "none": null
    },
    "include_raw_body": false,
    "parse_response": "true"
}
```

**Sample Output**

### Update employee

Update an employee by their ID.
**Sample Input**

```json
{
    "employee_id": "12345",
    "custom_properties": [
        \{
            "key": "jobTitle",
            "value": "Senior Software Engineer"
        \},
        \{
            "key": "department",
            "value": "Engineering"
        \},
        \{
            "key": "workEmail",
            "value": "john.doe@example.com"
        \}
    ]
}
```

**Sample Output**

```json
{
    "success": true
}
```

## DDL operations

### Get time off types (DDL)

> **Warning:** Note that DDL operations can only be called directly by Connectors API, or when using CustomJS in the Embedded solution editor for e.g. DDL-dependent data mapping

**Sample Input**

```json
{}
```

**Sample Output**

```json
[
    \{
        "id": "1",
        "name": "Vacation",
        "icon": "palm-tree"
    \},
    \{
        "id": "2",
        "name": "Sick Leave",
        "icon": "medical-cross"
    \},
    \{
        "id": "3",
        "name": "Personal Day",
        "icon": "calendar"
    \},
    \{
        "id": "4",
        "name": "Bereavement",
        "icon": "flower"
    \},
    \{
        "id": "5",
        "name": "Jury Duty",
        "icon": "gavel"
    \}
]
```

### List employee fields (DDL)

> **Warning:** Note that DDL operations can only be called directly by Connectors API, or when using CustomJS in the Embedded solution editor for e.g. DDL-dependent data mapping

**Sample Input**

```json
{}
```

**Sample Output**

### List table fields (DDL)

> **Warning:** Note that DDL operations can only be called directly by Connectors API, or when using CustomJS in the Embedded solution editor for e.g. DDL-dependent data mapping

**Sample Input**

```json
{}
```

**Sample Output**

### List tables (DDL)

> **Warning:** Note that DDL operations can only be called directly by Connectors API, or when using CustomJS in the Embedded solution editor for e.g. DDL-dependent data mapping

**Sample Input**
**Sample Output**

```json
[
    \{
        "tableName": "employees",
        "ddl": "CREATE TABLE employees (\n  id INT PRIMARY KEY,\n  firstName VARCHAR(50),\n  lastName VARCHAR(50),\n  email VARCHAR(100),\n  hireDate DATE,\n  jobTitle VARCHAR(100),\n  department VARCHAR(50)\n);"
    \},
    \{
        "tableName": "departments",
        "ddl": "CREATE TABLE departments (\n  id INT PRIMARY KEY,\n  name VARCHAR(50),\n  managerID INT,\n  FOREIGN KEY (managerID) REFERENCES employees(id)\n);"
    \},
    \{
        "tableName": "salaries",
        "ddl": "CREATE TABLE salaries (\n  id INT PRIMARY KEY,\n  employeeID INT,\n  salary DECIMAL(10, 2),\n  effectiveDate DATE,\n  FOREIGN KEY (employeeID) REFERENCES employees(id)\n);"
    \}
]
```
