Skip to content
This repository has been archived by the owner on Apr 23, 2021. It is now read-only.

Latest commit

 

History

History
926 lines (681 loc) · 37.1 KB

V1EmployeesApi.md

File metadata and controls

926 lines (681 loc) · 37.1 KB

V1EmployeesApi

All URIs are relative to https://connect.squareup.com

Method HTTP request Description
createEmployee POST /v1/me/employees CreateEmployee
createEmployeeRole POST /v1/me/roles CreateEmployeeRole
createTimecard POST /v1/me/timecards CreateTimecard
deleteTimecard DELETE /v1/me/timecards/{timecard_id} DeleteTimecard
listCashDrawerShifts GET /v1/{location_id}/cash-drawer-shifts ListCashDrawerShifts
listEmployeeRoles GET /v1/me/roles ListEmployeeRoles
listEmployees GET /v1/me/employees ListEmployees
listTimecardEvents GET /v1/me/timecards/{timecard_id}/events ListTimecardEvents
listTimecards GET /v1/me/timecards ListTimecards
retrieveCashDrawerShift GET /v1/{location_id}/cash-drawer-shifts/{shift_id} RetrieveCashDrawerShift
retrieveEmployee GET /v1/me/employees/{employee_id} RetrieveEmployee
retrieveEmployeeRole GET /v1/me/roles/{role_id} RetrieveEmployeeRole
retrieveTimecard GET /v1/me/timecards/{timecard_id} RetrieveTimecard
updateEmployee PUT /v1/me/employees/{employee_id} UpdateEmployee
updateEmployeeRole PUT /v1/me/roles/{role_id} UpdateEmployeeRole
updateTimecard PUT /v1/me/timecards/{timecard_id} UpdateTimecard

createEmployee

V1Employee createEmployee(body)

CreateEmployee

Use the CreateEmployee endpoint to add an employee to a Square account. Employees created with the Connect API have an initial status of `INACTIVE`. Inactive employees cannot sign in to Square Point of Sale until they are activated from the Square Dashboard. Employee status cannot be changed with the Connect API. <aside class=&quot;important&quot;> Employee entities cannot be deleted. To disable employee profiles, set the employee's status to <code>INACTIVE</code> </aside>

Example

// Import classes:
//import com.squareup.connect.ApiClient;
//import com.squareup.connect.ApiException;
//import com.squareup.connect.Configuration;
//import com.squareup.connect.auth.*;
//import com.squareup.connect.api.V1EmployeesApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: oauth2
OAuth oauth2 = (OAuth) defaultClient.getAuthentication("oauth2");
oauth2.setAccessToken("YOUR ACCESS TOKEN");

V1EmployeesApi apiInstance = new V1EmployeesApi();
V1Employee body = new V1Employee(); // V1Employee | An object containing the fields to POST for the request.  See the corresponding object definition for field details.
try {
    V1Employee result = apiInstance.createEmployee(body);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling V1EmployeesApi#createEmployee");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
body V1Employee An object containing the fields to POST for the request. See the corresponding object definition for field details.

Return type

V1Employee

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

createEmployeeRole

V1EmployeeRole createEmployeeRole(employeeRole)

CreateEmployeeRole

Creates an employee role you can then assign to employees. Square accounts can include any number of roles that can be assigned to employees. These roles define the actions and permissions granted to an employee with that role. For example, an employee with a &quot;Shift Manager&quot; role might be able to issue refunds in Square Point of Sale, whereas an employee with a &quot;Clerk&quot; role might not. Roles are assigned with the V1UpdateEmployee endpoint. An employee can have only one role at a time. If an employee has no role, they have none of the permissions associated with roles. All employees can accept payments with Square Point of Sale.

Example

// Import classes:
//import com.squareup.connect.ApiClient;
//import com.squareup.connect.ApiException;
//import com.squareup.connect.Configuration;
//import com.squareup.connect.auth.*;
//import com.squareup.connect.api.V1EmployeesApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: oauth2
OAuth oauth2 = (OAuth) defaultClient.getAuthentication("oauth2");
oauth2.setAccessToken("YOUR ACCESS TOKEN");

V1EmployeesApi apiInstance = new V1EmployeesApi();
V1EmployeeRole employeeRole = new V1EmployeeRole(); // V1EmployeeRole | An EmployeeRole object with a name and permissions, and an optional owner flag.
try {
    V1EmployeeRole result = apiInstance.createEmployeeRole(employeeRole);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling V1EmployeesApi#createEmployeeRole");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
employeeRole V1EmployeeRole An EmployeeRole object with a name and permissions, and an optional owner flag.

Return type

V1EmployeeRole

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

createTimecard

V1Timecard createTimecard(body)

CreateTimecard

Creates a timecard for an employee and clocks them in with an `API_CREATE` event and a `clockin_time` set to the current time unless the request provides a different value. To import timecards from another system (rather than clocking someone in). Specify the `clockin_time` and* `clockout_time` in the request. Timecards correspond to exactly one shift for a given employee, bounded by the `clockin_time` and `clockout_time` fields. An employee is considered clocked in if they have a timecard that doesn't have a `clockout_time` set. An employee that is currently clocked in cannot be clocked in a second time.

Example

// Import classes:
//import com.squareup.connect.ApiClient;
//import com.squareup.connect.ApiException;
//import com.squareup.connect.Configuration;
//import com.squareup.connect.auth.*;
//import com.squareup.connect.api.V1EmployeesApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: oauth2
OAuth oauth2 = (OAuth) defaultClient.getAuthentication("oauth2");
oauth2.setAccessToken("YOUR ACCESS TOKEN");

V1EmployeesApi apiInstance = new V1EmployeesApi();
V1Timecard body = new V1Timecard(); // V1Timecard | An object containing the fields to POST for the request.  See the corresponding object definition for field details.
try {
    V1Timecard result = apiInstance.createTimecard(body);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling V1EmployeesApi#createTimecard");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
body V1Timecard An object containing the fields to POST for the request. See the corresponding object definition for field details.

Return type

V1Timecard

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

deleteTimecard

Object deleteTimecard(timecardId)

DeleteTimecard

Deletes a timecard. Timecards can also be deleted through the Square Dashboard. Deleted timecards are still accessible through Connect API endpoints, but cannot be modified. The `deleted` field of the `Timecard` object indicates whether the timecard has been deleted. Note*: By default, deleted timecards appear alongside valid timecards in results returned by the ListTimecards endpoint. To filter deleted timecards, include the `deleted` query parameter in the list request. <aside> Only approved accounts can manage their employees with Square. Unapproved accounts cannot use employee management features with the API. </aside>

Example

// Import classes:
//import com.squareup.connect.ApiClient;
//import com.squareup.connect.ApiException;
//import com.squareup.connect.Configuration;
//import com.squareup.connect.auth.*;
//import com.squareup.connect.api.V1EmployeesApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: oauth2
OAuth oauth2 = (OAuth) defaultClient.getAuthentication("oauth2");
oauth2.setAccessToken("YOUR ACCESS TOKEN");

V1EmployeesApi apiInstance = new V1EmployeesApi();
String timecardId = "timecardId_example"; // String | The ID of the timecard to delete.
try {
    Object result = apiInstance.deleteTimecard(timecardId);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling V1EmployeesApi#deleteTimecard");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
timecardId String The ID of the timecard to delete.

Return type

Object

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

listCashDrawerShifts

List<V1CashDrawerShift> listCashDrawerShifts(locationId, order, beginTime, endTime)

ListCashDrawerShifts

Provides the details for all of a location's cash drawer shifts during a date range. The date range you specify cannot exceed 90 days.

Example

// Import classes:
//import com.squareup.connect.ApiClient;
//import com.squareup.connect.ApiException;
//import com.squareup.connect.Configuration;
//import com.squareup.connect.auth.*;
//import com.squareup.connect.api.V1EmployeesApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: oauth2
OAuth oauth2 = (OAuth) defaultClient.getAuthentication("oauth2");
oauth2.setAccessToken("YOUR ACCESS TOKEN");

V1EmployeesApi apiInstance = new V1EmployeesApi();
String locationId = "locationId_example"; // String | The ID of the location to list cash drawer shifts for.
String order = "order_example"; // String | The order in which cash drawer shifts are listed in the response, based on their created_at field. Default value: ASC
String beginTime = "beginTime_example"; // String | The beginning of the requested reporting period, in ISO 8601 format. Default value: The current time minus 90 days.
String endTime = "endTime_example"; // String | The beginning of the requested reporting period, in ISO 8601 format. Default value: The current time.
try {
    List<V1CashDrawerShift> result = apiInstance.listCashDrawerShifts(locationId, order, beginTime, endTime);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling V1EmployeesApi#listCashDrawerShifts");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
locationId String The ID of the location to list cash drawer shifts for.
order String The order in which cash drawer shifts are listed in the response, based on their created_at field. Default value: ASC [optional]
beginTime String The beginning of the requested reporting period, in ISO 8601 format. Default value: The current time minus 90 days. [optional]
endTime String The beginning of the requested reporting period, in ISO 8601 format. Default value: The current time. [optional]

Return type

List<V1CashDrawerShift>

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

listEmployeeRoles

List<V1EmployeeRole> listEmployeeRoles(order, limit, batchToken)

ListEmployeeRoles

Provides summary information for all of a business's employee roles.

Example

// Import classes:
//import com.squareup.connect.ApiClient;
//import com.squareup.connect.ApiException;
//import com.squareup.connect.Configuration;
//import com.squareup.connect.auth.*;
//import com.squareup.connect.api.V1EmployeesApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: oauth2
OAuth oauth2 = (OAuth) defaultClient.getAuthentication("oauth2");
oauth2.setAccessToken("YOUR ACCESS TOKEN");

V1EmployeesApi apiInstance = new V1EmployeesApi();
String order = "order_example"; // String | The order in which employees are listed in the response, based on their created_at field.Default value: ASC
Integer limit = 56; // Integer | The maximum integer number of employee entities to return in a single response. Default 100, maximum 200.
String batchToken = "batchToken_example"; // String | A pagination cursor to retrieve the next set of results for your original query to the endpoint.
try {
    List<V1EmployeeRole> result = apiInstance.listEmployeeRoles(order, limit, batchToken);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling V1EmployeesApi#listEmployeeRoles");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
order String The order in which employees are listed in the response, based on their created_at field.Default value: ASC [optional]
limit Integer The maximum integer number of employee entities to return in a single response. Default 100, maximum 200. [optional]
batchToken String A pagination cursor to retrieve the next set of results for your original query to the endpoint. [optional]

Return type

List<V1EmployeeRole>

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

listEmployees

List<V1Employee> listEmployees(order, beginUpdatedAt, endUpdatedAt, beginCreatedAt, endCreatedAt, status, externalId, limit, batchToken)

ListEmployees

Provides summary information for all of a business's employees.

Example

// Import classes:
//import com.squareup.connect.ApiClient;
//import com.squareup.connect.ApiException;
//import com.squareup.connect.Configuration;
//import com.squareup.connect.auth.*;
//import com.squareup.connect.api.V1EmployeesApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: oauth2
OAuth oauth2 = (OAuth) defaultClient.getAuthentication("oauth2");
oauth2.setAccessToken("YOUR ACCESS TOKEN");

V1EmployeesApi apiInstance = new V1EmployeesApi();
String order = "order_example"; // String | The order in which employees are listed in the response, based on their created_at field.      Default value: ASC
String beginUpdatedAt = "beginUpdatedAt_example"; // String | If filtering results by their updated_at field, the beginning of the requested reporting period, in ISO 8601 format
String endUpdatedAt = "endUpdatedAt_example"; // String | If filtering results by there updated_at field, the end of the requested reporting period, in ISO 8601 format.
String beginCreatedAt = "beginCreatedAt_example"; // String | If filtering results by their created_at field, the beginning of the requested reporting period, in ISO 8601 format.
String endCreatedAt = "endCreatedAt_example"; // String | If filtering results by their created_at field, the end of the requested reporting period, in ISO 8601 format.
String status = "status_example"; // String | If provided, the endpoint returns only employee entities with the specified status (ACTIVE or INACTIVE).
String externalId = "externalId_example"; // String | If provided, the endpoint returns only employee entities with the specified external_id.
Integer limit = 56; // Integer | The maximum integer number of employee entities to return in a single response. Default 100, maximum 200.
String batchToken = "batchToken_example"; // String | A pagination cursor to retrieve the next set of results for your original query to the endpoint.
try {
    List<V1Employee> result = apiInstance.listEmployees(order, beginUpdatedAt, endUpdatedAt, beginCreatedAt, endCreatedAt, status, externalId, limit, batchToken);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling V1EmployeesApi#listEmployees");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
order String The order in which employees are listed in the response, based on their created_at field. Default value: ASC [optional]
beginUpdatedAt String If filtering results by their updated_at field, the beginning of the requested reporting period, in ISO 8601 format [optional]
endUpdatedAt String If filtering results by there updated_at field, the end of the requested reporting period, in ISO 8601 format. [optional]
beginCreatedAt String If filtering results by their created_at field, the beginning of the requested reporting period, in ISO 8601 format. [optional]
endCreatedAt String If filtering results by their created_at field, the end of the requested reporting period, in ISO 8601 format. [optional]
status String If provided, the endpoint returns only employee entities with the specified status (ACTIVE or INACTIVE). [optional]
externalId String If provided, the endpoint returns only employee entities with the specified external_id. [optional]
limit Integer The maximum integer number of employee entities to return in a single response. Default 100, maximum 200. [optional]
batchToken String A pagination cursor to retrieve the next set of results for your original query to the endpoint. [optional]

Return type

List<V1Employee>

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

listTimecardEvents

List<V1TimecardEvent> listTimecardEvents(timecardId)

ListTimecardEvents

Provides summary information for all events associated with a particular timecard. <aside> Only approved accounts can manage their employees with Square. Unapproved accounts cannot use employee management features with the API. </aside>

Example

// Import classes:
//import com.squareup.connect.ApiClient;
//import com.squareup.connect.ApiException;
//import com.squareup.connect.Configuration;
//import com.squareup.connect.auth.*;
//import com.squareup.connect.api.V1EmployeesApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: oauth2
OAuth oauth2 = (OAuth) defaultClient.getAuthentication("oauth2");
oauth2.setAccessToken("YOUR ACCESS TOKEN");

V1EmployeesApi apiInstance = new V1EmployeesApi();
String timecardId = "timecardId_example"; // String | The ID of the timecard to list events for.
try {
    List<V1TimecardEvent> result = apiInstance.listTimecardEvents(timecardId);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling V1EmployeesApi#listTimecardEvents");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
timecardId String The ID of the timecard to list events for.

Return type

List<V1TimecardEvent>

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

listTimecards

List<V1Timecard> listTimecards(order, employeeId, beginClockinTime, endClockinTime, beginClockoutTime, endClockoutTime, beginUpdatedAt, endUpdatedAt, deleted, limit, batchToken)

ListTimecards

Provides summary information for all of a business's employee timecards.

Example

// Import classes:
//import com.squareup.connect.ApiClient;
//import com.squareup.connect.ApiException;
//import com.squareup.connect.Configuration;
//import com.squareup.connect.auth.*;
//import com.squareup.connect.api.V1EmployeesApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: oauth2
OAuth oauth2 = (OAuth) defaultClient.getAuthentication("oauth2");
oauth2.setAccessToken("YOUR ACCESS TOKEN");

V1EmployeesApi apiInstance = new V1EmployeesApi();
String order = "order_example"; // String | The order in which timecards are listed in the response, based on their created_at field.
String employeeId = "employeeId_example"; // String | If provided, the endpoint returns only timecards for the employee with the specified ID.
String beginClockinTime = "beginClockinTime_example"; // String | If filtering results by their clockin_time field, the beginning of the requested reporting period, in ISO 8601 format.
String endClockinTime = "endClockinTime_example"; // String | If filtering results by their clockin_time field, the end of the requested reporting period, in ISO 8601 format.
String beginClockoutTime = "beginClockoutTime_example"; // String | If filtering results by their clockout_time field, the beginning of the requested reporting period, in ISO 8601 format.
String endClockoutTime = "endClockoutTime_example"; // String | If filtering results by their clockout_time field, the end of the requested reporting period, in ISO 8601 format.
String beginUpdatedAt = "beginUpdatedAt_example"; // String | If filtering results by their updated_at field, the beginning of the requested reporting period, in ISO 8601 format.
String endUpdatedAt = "endUpdatedAt_example"; // String | If filtering results by their updated_at field, the end of the requested reporting period, in ISO 8601 format.
Boolean deleted = true; // Boolean | If true, only deleted timecards are returned. If false, only valid timecards are returned.If you don't provide this parameter, both valid and deleted timecards are returned.
Integer limit = 56; // Integer | The maximum integer number of employee entities to return in a single response. Default 100, maximum 200.
String batchToken = "batchToken_example"; // String | A pagination cursor to retrieve the next set of results for your original query to the endpoint.
try {
    List<V1Timecard> result = apiInstance.listTimecards(order, employeeId, beginClockinTime, endClockinTime, beginClockoutTime, endClockoutTime, beginUpdatedAt, endUpdatedAt, deleted, limit, batchToken);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling V1EmployeesApi#listTimecards");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
order String The order in which timecards are listed in the response, based on their created_at field. [optional]
employeeId String If provided, the endpoint returns only timecards for the employee with the specified ID. [optional]
beginClockinTime String If filtering results by their clockin_time field, the beginning of the requested reporting period, in ISO 8601 format. [optional]
endClockinTime String If filtering results by their clockin_time field, the end of the requested reporting period, in ISO 8601 format. [optional]
beginClockoutTime String If filtering results by their clockout_time field, the beginning of the requested reporting period, in ISO 8601 format. [optional]
endClockoutTime String If filtering results by their clockout_time field, the end of the requested reporting period, in ISO 8601 format. [optional]
beginUpdatedAt String If filtering results by their updated_at field, the beginning of the requested reporting period, in ISO 8601 format. [optional]
endUpdatedAt String If filtering results by their updated_at field, the end of the requested reporting period, in ISO 8601 format. [optional]
deleted Boolean If true, only deleted timecards are returned. If false, only valid timecards are returned.If you don't provide this parameter, both valid and deleted timecards are returned. [optional]
limit Integer The maximum integer number of employee entities to return in a single response. Default 100, maximum 200. [optional]
batchToken String A pagination cursor to retrieve the next set of results for your original query to the endpoint. [optional]

Return type

List<V1Timecard>

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

retrieveCashDrawerShift

V1CashDrawerShift retrieveCashDrawerShift(locationId, shiftId)

RetrieveCashDrawerShift

Provides the details for a single cash drawer shift, including all events that occurred during the shift.

Example

// Import classes:
//import com.squareup.connect.ApiClient;
//import com.squareup.connect.ApiException;
//import com.squareup.connect.Configuration;
//import com.squareup.connect.auth.*;
//import com.squareup.connect.api.V1EmployeesApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: oauth2
OAuth oauth2 = (OAuth) defaultClient.getAuthentication("oauth2");
oauth2.setAccessToken("YOUR ACCESS TOKEN");

V1EmployeesApi apiInstance = new V1EmployeesApi();
String locationId = "locationId_example"; // String | The ID of the location to list cash drawer shifts for.
String shiftId = "shiftId_example"; // String | The shift's ID.
try {
    V1CashDrawerShift result = apiInstance.retrieveCashDrawerShift(locationId, shiftId);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling V1EmployeesApi#retrieveCashDrawerShift");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
locationId String The ID of the location to list cash drawer shifts for.
shiftId String The shift's ID.

Return type

V1CashDrawerShift

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

retrieveEmployee

V1Employee retrieveEmployee(employeeId)

RetrieveEmployee

Provides the details for a single employee.

Example

// Import classes:
//import com.squareup.connect.ApiClient;
//import com.squareup.connect.ApiException;
//import com.squareup.connect.Configuration;
//import com.squareup.connect.auth.*;
//import com.squareup.connect.api.V1EmployeesApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: oauth2
OAuth oauth2 = (OAuth) defaultClient.getAuthentication("oauth2");
oauth2.setAccessToken("YOUR ACCESS TOKEN");

V1EmployeesApi apiInstance = new V1EmployeesApi();
String employeeId = "employeeId_example"; // String | The employee's ID.
try {
    V1Employee result = apiInstance.retrieveEmployee(employeeId);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling V1EmployeesApi#retrieveEmployee");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
employeeId String The employee's ID.

Return type

V1Employee

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

retrieveEmployeeRole

V1EmployeeRole retrieveEmployeeRole(roleId)

RetrieveEmployeeRole

Provides the details for a single employee role.

Example

// Import classes:
//import com.squareup.connect.ApiClient;
//import com.squareup.connect.ApiException;
//import com.squareup.connect.Configuration;
//import com.squareup.connect.auth.*;
//import com.squareup.connect.api.V1EmployeesApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: oauth2
OAuth oauth2 = (OAuth) defaultClient.getAuthentication("oauth2");
oauth2.setAccessToken("YOUR ACCESS TOKEN");

V1EmployeesApi apiInstance = new V1EmployeesApi();
String roleId = "roleId_example"; // String | The role's ID.
try {
    V1EmployeeRole result = apiInstance.retrieveEmployeeRole(roleId);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling V1EmployeesApi#retrieveEmployeeRole");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
roleId String The role's ID.

Return type

V1EmployeeRole

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

retrieveTimecard

V1Timecard retrieveTimecard(timecardId)

RetrieveTimecard

Provides the details for a single timecard. <aside> Only approved accounts can manage their employees with Square. Unapproved accounts cannot use employee management features with the API. </aside>

Example

// Import classes:
//import com.squareup.connect.ApiClient;
//import com.squareup.connect.ApiException;
//import com.squareup.connect.Configuration;
//import com.squareup.connect.auth.*;
//import com.squareup.connect.api.V1EmployeesApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: oauth2
OAuth oauth2 = (OAuth) defaultClient.getAuthentication("oauth2");
oauth2.setAccessToken("YOUR ACCESS TOKEN");

V1EmployeesApi apiInstance = new V1EmployeesApi();
String timecardId = "timecardId_example"; // String | The timecard's ID.
try {
    V1Timecard result = apiInstance.retrieveTimecard(timecardId);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling V1EmployeesApi#retrieveTimecard");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
timecardId String The timecard's ID.

Return type

V1Timecard

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

updateEmployee

V1Employee updateEmployee(employeeId, body)

UpdateEmployee

Example

// Import classes:
//import com.squareup.connect.ApiClient;
//import com.squareup.connect.ApiException;
//import com.squareup.connect.Configuration;
//import com.squareup.connect.auth.*;
//import com.squareup.connect.api.V1EmployeesApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: oauth2
OAuth oauth2 = (OAuth) defaultClient.getAuthentication("oauth2");
oauth2.setAccessToken("YOUR ACCESS TOKEN");

V1EmployeesApi apiInstance = new V1EmployeesApi();
String employeeId = "employeeId_example"; // String | The ID of the role to modify.
V1Employee body = new V1Employee(); // V1Employee | An object containing the fields to POST for the request.  See the corresponding object definition for field details.
try {
    V1Employee result = apiInstance.updateEmployee(employeeId, body);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling V1EmployeesApi#updateEmployee");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
employeeId String The ID of the role to modify.
body V1Employee An object containing the fields to POST for the request. See the corresponding object definition for field details.

Return type

V1Employee

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

updateEmployeeRole

V1EmployeeRole updateEmployeeRole(roleId, body)

UpdateEmployeeRole

Modifies the details of an employee role.

Example

// Import classes:
//import com.squareup.connect.ApiClient;
//import com.squareup.connect.ApiException;
//import com.squareup.connect.Configuration;
//import com.squareup.connect.auth.*;
//import com.squareup.connect.api.V1EmployeesApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: oauth2
OAuth oauth2 = (OAuth) defaultClient.getAuthentication("oauth2");
oauth2.setAccessToken("YOUR ACCESS TOKEN");

V1EmployeesApi apiInstance = new V1EmployeesApi();
String roleId = "roleId_example"; // String | The ID of the role to modify.
V1EmployeeRole body = new V1EmployeeRole(); // V1EmployeeRole | An object containing the fields to POST for the request.  See the corresponding object definition for field details.
try {
    V1EmployeeRole result = apiInstance.updateEmployeeRole(roleId, body);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling V1EmployeesApi#updateEmployeeRole");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
roleId String The ID of the role to modify.
body V1EmployeeRole An object containing the fields to POST for the request. See the corresponding object definition for field details.

Return type

V1EmployeeRole

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

updateTimecard

V1Timecard updateTimecard(timecardId, body)

UpdateTimecard

Modifies the details of a timecard with an `API_EDIT` event for the timecard. Updating an active timecard with a `clockout_time` clocks the employee out.

Example

// Import classes:
//import com.squareup.connect.ApiClient;
//import com.squareup.connect.ApiException;
//import com.squareup.connect.Configuration;
//import com.squareup.connect.auth.*;
//import com.squareup.connect.api.V1EmployeesApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: oauth2
OAuth oauth2 = (OAuth) defaultClient.getAuthentication("oauth2");
oauth2.setAccessToken("YOUR ACCESS TOKEN");

V1EmployeesApi apiInstance = new V1EmployeesApi();
String timecardId = "timecardId_example"; // String | TThe ID of the timecard to modify.
V1Timecard body = new V1Timecard(); // V1Timecard | An object containing the fields to POST for the request. See the corresponding object definition for field details.
try {
    V1Timecard result = apiInstance.updateTimecard(timecardId, body);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling V1EmployeesApi#updateTimecard");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
timecardId String TThe ID of the timecard to modify.
body V1Timecard An object containing the fields to POST for the request. See the corresponding object definition for field details.

Return type

V1Timecard

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json