SquareConnect\LaborApi

August 15, 2019 · View on GitHub

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

MethodHTTP requestDescription
createBreakTypePOST /v2/labor/break-typesCreateBreakType
createShiftPOST /v2/labor/shiftsCreateShift
deleteBreakTypeDELETE /v2/labor/break-types/{id}DeleteBreakType
deleteShiftDELETE /v2/labor/shifts/{id}DeleteShift
getBreakTypeGET /v2/labor/break-types/{id}GetBreakType
getEmployeeWageGET /v2/labor/employee-wages/{id}GetEmployeeWage
getShiftGET /v2/labor/shifts/{id}GetShift
listBreakTypesGET /v2/labor/break-typesListBreakTypes
listEmployeeWagesGET /v2/labor/employee-wagesListEmployeeWages
listWorkweekConfigsGET /v2/labor/workweek-configsListWorkweekConfigs
searchShiftsPOST /v2/labor/shifts/searchSearchShifts
updateBreakTypePUT /v2/labor/break-types/{id}UpdateBreakType
updateShiftPUT /v2/labor/shifts/{id}UpdateShift
updateWorkweekConfigPUT /v2/labor/workweek-configs/{id}UpdateWorkweekConfig

createBreakType

\SquareConnect\Model\CreateBreakTypeResponse createBreakType($body)

CreateBreakType

Creates a new BreakType. A BreakType is a template for creating Break objects. You must provide the following values in your request to this endpoint: - location_id - break_name - expected_duration - is_paid You can only have 3 BreakType instances per location. If you attempt to add a 4th BreakType for a location, an INVALID_REQUEST_ERROR "Exceeded limit of 3 breaks per location." is returned.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: oauth2
SquareConnect\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = new SquareConnect\Api\LaborApi();
$body = new \SquareConnect\Model\CreateBreakTypeRequest(); // \SquareConnect\Model\CreateBreakTypeRequest | An object containing the fields to POST for the request.  See the corresponding object definition for field details.

try {
    $result = $apiInstance->createBreakType($body);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling LaborApi->createBreakType: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

NameTypeDescriptionNotes
body\SquareConnect\Model\CreateBreakTypeRequestAn object containing the fields to POST for the request. See the corresponding object definition for field details.

Return type

\SquareConnect\Model\CreateBreakTypeResponse

Authorization

oauth2

HTTP request headers

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

[Back to top] [Back to API list] [Back to Model list] [Back to README]

createShift

\SquareConnect\Model\CreateShiftResponse createShift($body)

CreateShift

Creates a new Shift. A Shift represents a complete work day for a single employee. You must provide the following values in your request to this endpoint: - location_id - employee_id - start_at An attempt to create a new Shift can result in a BAD_REQUEST error when: - The status of the new Shift is OPEN and the employee has another shift with an OPEN status. - The start_at date is in the future - the start_at or end_at overlaps another shift for the same employee - If Breaks are set in the request, a break start_at must not be before the Shift.start_at. A break end_at must not be after the Shift.end_at

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: oauth2
SquareConnect\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = new SquareConnect\Api\LaborApi();
$body = new \SquareConnect\Model\CreateShiftRequest(); // \SquareConnect\Model\CreateShiftRequest | An object containing the fields to POST for the request.  See the corresponding object definition for field details.

try {
    $result = $apiInstance->createShift($body);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling LaborApi->createShift: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

NameTypeDescriptionNotes
body\SquareConnect\Model\CreateShiftRequestAn object containing the fields to POST for the request. See the corresponding object definition for field details.

Return type

\SquareConnect\Model\CreateShiftResponse

Authorization

oauth2

HTTP request headers

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

[Back to top] [Back to API list] [Back to Model list] [Back to README]

deleteBreakType

\SquareConnect\Model\DeleteBreakTypeResponse deleteBreakType($id)

DeleteBreakType

Deletes an existing BreakType. A BreakType can be deleted even if it is referenced from a Shift.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: oauth2
SquareConnect\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = new SquareConnect\Api\LaborApi();
$id = "id_example"; // string | UUID for the `BreakType` being deleted.

try {
    $result = $apiInstance->deleteBreakType($id);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling LaborApi->deleteBreakType: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

NameTypeDescriptionNotes
idstringUUID for the `BreakType` being deleted.

Return type

\SquareConnect\Model\DeleteBreakTypeResponse

Authorization

oauth2

HTTP request headers

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

[Back to top] [Back to API list] [Back to Model list] [Back to README]

deleteShift

\SquareConnect\Model\DeleteShiftResponse deleteShift($id)

DeleteShift

Deletes a Shift.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: oauth2
SquareConnect\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = new SquareConnect\Api\LaborApi();
$id = "id_example"; // string | UUID for the `Shift` being deleted.

try {
    $result = $apiInstance->deleteShift($id);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling LaborApi->deleteShift: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

NameTypeDescriptionNotes
idstringUUID for the `Shift` being deleted.

Return type

\SquareConnect\Model\DeleteShiftResponse

Authorization

oauth2

HTTP request headers

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

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getBreakType

\SquareConnect\Model\GetBreakTypeResponse getBreakType($id)

GetBreakType

Returns a single BreakType specified by id.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: oauth2
SquareConnect\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = new SquareConnect\Api\LaborApi();
$id = "id_example"; // string | UUID for the `BreakType` being retrieved.

try {
    $result = $apiInstance->getBreakType($id);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling LaborApi->getBreakType: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

NameTypeDescriptionNotes
idstringUUID for the `BreakType` being retrieved.

Return type

\SquareConnect\Model\GetBreakTypeResponse

Authorization

oauth2

HTTP request headers

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

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getEmployeeWage

\SquareConnect\Model\GetEmployeeWageResponse getEmployeeWage($id)

GetEmployeeWage

Returns a single EmployeeWage specified by id.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: oauth2
SquareConnect\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = new SquareConnect\Api\LaborApi();
$id = "id_example"; // string | UUID for the `EmployeeWage` being retrieved.

try {
    $result = $apiInstance->getEmployeeWage($id);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling LaborApi->getEmployeeWage: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

NameTypeDescriptionNotes
idstringUUID for the `EmployeeWage` being retrieved.

Return type

\SquareConnect\Model\GetEmployeeWageResponse

Authorization

oauth2

HTTP request headers

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

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getShift

\SquareConnect\Model\GetShiftResponse getShift($id)

GetShift

Returns a single Shift specified by id.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: oauth2
SquareConnect\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = new SquareConnect\Api\LaborApi();
$id = "id_example"; // string | UUID for the `Shift` being retrieved.

try {
    $result = $apiInstance->getShift($id);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling LaborApi->getShift: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

NameTypeDescriptionNotes
idstringUUID for the `Shift` being retrieved.

Return type

\SquareConnect\Model\GetShiftResponse

Authorization

oauth2

HTTP request headers

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

[Back to top] [Back to API list] [Back to Model list] [Back to README]

listBreakTypes

\SquareConnect\Model\ListBreakTypesResponse listBreakTypes(locationid,location_id, limit, $cursor)

ListBreakTypes

Returns a paginated list of BreakType instances for a business.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: oauth2
SquareConnect\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = new SquareConnect\Api\LaborApi();
$location_id = "location_id_example"; // string | Filter Break Types returned to only those that are associated with the specified location.
$limit = 56; // int | Maximum number of Break Types to return per page. Can range between 1 and 200. The default is the maximum at 200.
$cursor = "cursor_example"; // string | Pointer to the next page of Break Type results to fetch.

try {
    $result = $apiInstance->listBreakTypes($location_id, $limit, $cursor);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling LaborApi->listBreakTypes: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

NameTypeDescriptionNotes
location_idstringFilter Break Types returned to only those that are associated with the specified location.[optional]
limitintMaximum number of Break Types to return per page. Can range between 1 and 200. The default is the maximum at 200.[optional]
cursorstringPointer to the next page of Break Type results to fetch.[optional]

Return type

\SquareConnect\Model\ListBreakTypesResponse

Authorization

oauth2

HTTP request headers

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

[Back to top] [Back to API list] [Back to Model list] [Back to README]

listEmployeeWages

\SquareConnect\Model\ListEmployeeWagesResponse listEmployeeWages(employeeid,employee_id, limit, $cursor)

ListEmployeeWages

Returns a paginated list of EmployeeWage instances for a business.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: oauth2
SquareConnect\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = new SquareConnect\Api\LaborApi();
$employee_id = "employee_id_example"; // string | Filter wages returned to only those that are associated with the specified employee.
$limit = 56; // int | Maximum number of Employee Wages to return per page. Can range between 1 and 200. The default is the maximum at 200.
$cursor = "cursor_example"; // string | Pointer to the next page of Employee Wage results to fetch.

try {
    $result = $apiInstance->listEmployeeWages($employee_id, $limit, $cursor);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling LaborApi->listEmployeeWages: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

NameTypeDescriptionNotes
employee_idstringFilter wages returned to only those that are associated with the specified employee.[optional]
limitintMaximum number of Employee Wages to return per page. Can range between 1 and 200. The default is the maximum at 200.[optional]
cursorstringPointer to the next page of Employee Wage results to fetch.[optional]

Return type

\SquareConnect\Model\ListEmployeeWagesResponse

Authorization

oauth2

HTTP request headers

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

[Back to top] [Back to API list] [Back to Model list] [Back to README]

listWorkweekConfigs

\SquareConnect\Model\ListWorkweekConfigsResponse listWorkweekConfigs(limit,limit, cursor)

ListWorkweekConfigs

Returns a list of WorkweekConfig instances for a business.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: oauth2
SquareConnect\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = new SquareConnect\Api\LaborApi();
$limit = 56; // int | Maximum number of Workweek Configs to return per page.
$cursor = "cursor_example"; // string | Pointer to the next page of Workweek Config results to fetch.

try {
    $result = $apiInstance->listWorkweekConfigs($limit, $cursor);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling LaborApi->listWorkweekConfigs: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

NameTypeDescriptionNotes
limitintMaximum number of Workweek Configs to return per page.[optional]
cursorstringPointer to the next page of Workweek Config results to fetch.[optional]

Return type

\SquareConnect\Model\ListWorkweekConfigsResponse

Authorization

oauth2

HTTP request headers

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

[Back to top] [Back to API list] [Back to Model list] [Back to README]

searchShifts

\SquareConnect\Model\SearchShiftsResponse searchShifts($body)

SearchShifts

Returns a paginated list of Shift records for a business. The list to be returned can be filtered by: - Location IDs and - employee IDs and - shift status (OPEN, CLOSED) and - shift start and - shift end and - work day details The list can be sorted by: - start_at - end_at - created_at - updated_at

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: oauth2
SquareConnect\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = new SquareConnect\Api\LaborApi();
$body = new \SquareConnect\Model\SearchShiftsRequest(); // \SquareConnect\Model\SearchShiftsRequest | An object containing the fields to POST for the request.  See the corresponding object definition for field details.

try {
    $result = $apiInstance->searchShifts($body);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling LaborApi->searchShifts: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

NameTypeDescriptionNotes
body\SquareConnect\Model\SearchShiftsRequestAn object containing the fields to POST for the request. See the corresponding object definition for field details.

Return type

\SquareConnect\Model\SearchShiftsResponse

Authorization

oauth2

HTTP request headers

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

[Back to top] [Back to API list] [Back to Model list] [Back to README]

updateBreakType

\SquareConnect\Model\UpdateBreakTypeResponse updateBreakType(id,id, body)

UpdateBreakType

Updates an existing BreakType.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: oauth2
SquareConnect\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = new SquareConnect\Api\LaborApi();
$id = "id_example"; // string | UUID for the `BreakType` being updated.
$body = new \SquareConnect\Model\UpdateBreakTypeRequest(); // \SquareConnect\Model\UpdateBreakTypeRequest | An object containing the fields to POST for the request.  See the corresponding object definition for field details.

try {
    $result = $apiInstance->updateBreakType($id, $body);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling LaborApi->updateBreakType: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

NameTypeDescriptionNotes
idstringUUID for the `BreakType` being updated.
body\SquareConnect\Model\UpdateBreakTypeRequestAn object containing the fields to POST for the request. See the corresponding object definition for field details.

Return type

\SquareConnect\Model\UpdateBreakTypeResponse

Authorization

oauth2

HTTP request headers

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

[Back to top] [Back to API list] [Back to Model list] [Back to README]

updateShift

\SquareConnect\Model\UpdateShiftResponse updateShift(id,id, body)

UpdateShift

Updates an existing Shift. When adding a Break to a Shift, any earlier Breaks in the Shift have the end_at property set to a valid RFC-3339 datetime string. When closing a Shift, all Break instances in the shift must be complete with end_at set on each Break.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: oauth2
SquareConnect\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = new SquareConnect\Api\LaborApi();
$id = "id_example"; // string | ID of the object being updated.
$body = new \SquareConnect\Model\UpdateShiftRequest(); // \SquareConnect\Model\UpdateShiftRequest | An object containing the fields to POST for the request.  See the corresponding object definition for field details.

try {
    $result = $apiInstance->updateShift($id, $body);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling LaborApi->updateShift: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

NameTypeDescriptionNotes
idstringID of the object being updated.
body\SquareConnect\Model\UpdateShiftRequestAn object containing the fields to POST for the request. See the corresponding object definition for field details.

Return type

\SquareConnect\Model\UpdateShiftResponse

Authorization

oauth2

HTTP request headers

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

[Back to top] [Back to API list] [Back to Model list] [Back to README]

updateWorkweekConfig

\SquareConnect\Model\UpdateWorkweekConfigResponse updateWorkweekConfig(id,id, body)

UpdateWorkweekConfig

Updates a WorkweekConfig.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: oauth2
SquareConnect\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = new SquareConnect\Api\LaborApi();
$id = "id_example"; // string | UUID for the `WorkweekConfig` object being updated.
$body = new \SquareConnect\Model\UpdateWorkweekConfigRequest(); // \SquareConnect\Model\UpdateWorkweekConfigRequest | An object containing the fields to POST for the request.  See the corresponding object definition for field details.

try {
    $result = $apiInstance->updateWorkweekConfig($id, $body);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling LaborApi->updateWorkweekConfig: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

NameTypeDescriptionNotes
idstringUUID for the `WorkweekConfig` object being updated.
body\SquareConnect\Model\UpdateWorkweekConfigRequestAn object containing the fields to POST for the request. See the corresponding object definition for field details.

Return type

\SquareConnect\Model\UpdateWorkweekConfigResponse

Authorization

oauth2

HTTP request headers

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

[Back to top] [Back to API list] [Back to Model list] [Back to README]