REST API: Managing Clients

Managing Clients

If you have the External Access add-on installed, you can make API requests using your auth token against clients that you manage. When you want to make an API request against one of the clients that you manage, you must include an additional header in each request, vnd.tsheets.ManagedClientId.

The value of the header is the client ID of the account you are managing. You can obtain the client IDs of the clients you manage by issuing a GET on the /managed_clients endpoint.

Examples

Retrieve the users on a managed client's account.

## Request
curl -H "Authorization: Bearer <Access-Token>" -H "vnd.tsheets.ManagedClientId: <Managed-Client-Id>"  -i "https://rest.tsheets.com/api/v1/users"        

## Response (shortened for readability)   
HTTP/1.1 200 OK
Content-Type: application/json

{
 "results": {
  "users": {
   "1283037": {
    "id": 1283037,
    "first_name": "Joni",
    "last_name": "Smith",
    "group_id": 0,
    "active": true,
    "employee_number": 0,
    "salaried": false,
    "exempt": false,
    "username": "joni",
    "email": "",
    "payroll_id": "",
    "hire_date": "0000-00-00",
    "term_date": "0000-00-00",
    "job_title": "",
    "gender": "",
    "last_modified": "2013-07-12T17:24:33+00:00",
    "last_active": "",
    "created": "2013-07-12T17:24:33+00:00",
    "mobile_number": "",
    "pto_balances": {
        "8234": 0,
        "424242": 144000,
        "123": 3600
    },
    "require_password_change": false,
    "pay_rate": 20,
    "pay_interval": "hour",
    "permissions": {
     "admin": false,
     "mobile": false,
     "status_box": false,
     "reports": false,
     "manage_timesheets": false,
     "manage_authorization": false,
     "manage_users": false,
     "manage_my_timesheets": false,
     "manage_jobcodes": false,
     "approve_timesheets": false,
     "manage_no_schedules": false,
     "manage_my_schedule": false,
     "manage_schedules": true,
     "manage_company_schedules": false,
     "view_my_schedules": false,
     "view_group_schedules": false,
     "view_company_schedules": false
    }
   },
   "1283039": {
    "id": 1283039,
    "first_name": "Frank",
    "last_name": "Church",
    ...
   }
  }
 },
 "more": false,
 "supplemental_data": {
  "groups": {
   "144959": {
    "id": 144959,
    "name": "test3",
    "last_modified": "2013-07-12T15:32:25+00:00",
    "created": "2013-07-12T15:32:25+00:00"
   }
  }
 }
}