Getting Labour List
Function : list_labours()
Purpose
This function retrieves a paginated list of labours available in the system. Each labour record includes identification details, profile information, contact details, custom availability schedules, and related metadata.
Parameters
| Parameter | Type | Description |
|---|---|---|
| limit | Integer | Number of labour records to retrieve per page. |
| offset | Integer | Number of records to skip from the beginning of the result set. |
| records | Integer | Total number of records returned in the current response. |
| previous_page | String | URL for the previous page of results, if available. |
| next_page | String | URL for the next page of results, if available. |
Use Case
This function is used to view and manage labour resources within the system. It helps administrators and managers review available labour records, check labour profiles, inspect availability schedules, validate contact details, and support workforce planning and assignment workflows.
def test_list_labours():
SDKConfig.PRINT_REQUEST_DATA = True
SDKConfig.PRINT_RAW_RESPONSE = False
token_file_path = "shared_token.json"
file_token_mgr = FileTokenManager(token_file_path)
exsited_sdk: ExsitedSDK = ExsitedSDK().init_sdk(
request_token_dto=CommonData.get_request_token_dto(),
file_token_mgr=file_token_mgr
)
try:
response = exsited_sdk.labour.list_labours(limit=10, offset=0)
print("List Labours Response:")
print(response)
if response.labours:
print(f"Total labours: {len(response.labours)}")
except ABException as ab:
print(ab)
print(ab.get_errors())
print(ab.raw_response)
public function testLabourListAll()
{
try {
echo "\n=== Testing List All Labours ===\n";
$response = $this->labourService->listAll();
echo '<pre>' . json_encode($response, JSON_PRETTY_PRINT) . '</pre>';
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
}
Response
The function returns an object containing a list of labour entries. Each labour includes details such as status, UUID, labour code, name, display name, description, email address, labour profile information, custom form template, audit fields, custom attributes, contact details, and custom availability schedules by day and time. Pagination details such as record count, limit, offset, and navigation links for previous and next pages are also included.
LabourListDTO(labours=[
LabourDataDTO(
status='LABOUR_STATUS',
uuid='LABOUR_UUID',
code='LABOUR_CODE',
name='LABOUR_NAME',
displayName='LABOUR_DISPLAY_NAME',
description='LABOUR_DESCRIPTION',
imageName='LABOUR_IMAGE_NAME',
emailAddress='LABOUR_EMAIL',
useCustomAvailability=USE_CUSTOM_AVAILABILITY,
labourProfile=LabourProfileDTO(
status='LABOUR_PROFILE_STATUS',
uuid='LABOUR_PROFILE_UUID',
name='LABOUR_PROFILE_NAME',
displayName='LABOUR_PROFILE_DISPLAY_NAME',
link='LABOUR_PROFILE_LINK'
),
customFormTemplate='LABOUR_CUSTOM_FORM_TEMPLATE',
createdBy='LABOUR_CREATED_BY',
createdOn='LABOUR_CREATED_ON',
lastUpdatedBy='LABOUR_LAST_UPDATED_BY',
lastUpdatedOn='LABOUR_LAST_UPDATED_ON',
customAttributes=[],
labourContacts=[
LabourContactDTO(
uuid='LABOUR_CONTACT_UUID',
contactType='LABOUR_CONTACT_TYPE',
value=LABOUR_CONTACT_VALUE,
isPrimary=LABOUR_CONTACT_IS_PRIMARY
)
],
labourCustomAvailability=[
LabourCustomAvailabilityDTO(
uuid='LABOUR_AVAILABILITY_UUID',
startTime='LABOUR_AVAILABILITY_START_TIME',
endTime='LABOUR_AVAILABILITY_END_TIME',
available='LABOUR_AVAILABILITY_AVAILABLE',
preferredDay='LABOUR_AVAILABILITY_PREFERRED_DAY',
operation=LABOUR_AVAILABILITY_OPERATION
)
]
)
])
{
"labours": [
{
"status": "LABOUR_STATUS",
"uuid": "LABOUR_UUID",
"code": "LABOUR_CODE",
"name": "LABOUR_NAME",
"display_name": "LABOUR_DISPLAY_NAME",
"description": "LABOUR_DESCRIPTION",
"image_name": "LABOUR_IMAGE_NAME",
"email_address": "LABOUR_EMAIL_ADDRESS",
"use_custom_availability": true,
"labour_profile": {
"status": "LABOUR_PROFILE_STATUS",
"uuid": "LABOUR_PROFILE_UUID",
"name": "LABOUR_PROFILE_NAME",
"display_name": "LABOUR_PROFILE_DISPLAY_NAME",
"link": "LABOUR_PROFILE_LINK"
},
"custom_form_template": "LABOUR_CUSTOM_FORM_TEMPLATE",
"created_by": "LABOUR_CREATED_BY",
"created_on": "LABOUR_CREATED_ON",
"last_updated_by": "LABOUR_LAST_UPDATED_BY",
"last_updated_on": "LABOUR_LAST_UPDATED_ON",
"custom_attributes": [],
"labour_contacts": [
{
"status": "LABOUR_CONTACT_STATUS",
"uuid": "LABOUR_CONTACT_UUID",
"contact_type": "LABOUR_CONTACT_TYPE",
"salutation": "LABOUR_CONTACT_SALUTATION",
"designation": "LABOUR_CONTACT_DESIGNATION",
"first_name": "LABOUR_CONTACT_FIRST_NAME",
"last_name": "LABOUR_CONTACT_LAST_NAME",
"middle_name": "LABOUR_CONTACT_MIDDLE_NAME",
"email_address": "LABOUR_CONTACT_EMAIL_ADDRESS",
"receive_email": "LABOUR_CONTACT_RECEIVE_EMAIL",
"phone": "LABOUR_CONTACT_PHONE",
"phone_area_code": "LABOUR_CONTACT_PHONE_AREA_CODE",
"phone_country_code": "LABOUR_CONTACT_PHONE_COUNTRY_CODE",
"do_not_phone": "LABOUR_CONTACT_DO_NOT_PHONE",
"fax": "LABOUR_CONTACT_FAX",
"fax_area_code": "LABOUR_CONTACT_FAX_AREA_CODE",
"fax_country_code": "LABOUR_CONTACT_FAX_COUNTRY_CODE",
"do_not_fax": "LABOUR_CONTACT_DO_NOT_FAX",
"mobile": "LABOUR_CONTACT_MOBILE",
"mobile_area_code": "LABOUR_CONTACT_MOBILE_AREA_CODE",
"mobile_country_code": "LABOUR_CONTACT_MOBILE_COUNTRY_CODE",
"do_not_mobile": "LABOUR_CONTACT_DO_NOT_MOBILE",
"country": "LABOUR_CONTACT_COUNTRY",
"state": "LABOUR_CONTACT_STATE",
"city": "LABOUR_CONTACT_CITY",
"post_code": "LABOUR_CONTACT_POST_CODE"
}
],
"labour_custom_availability": [
{
"uuid": "LABOUR_CUSTOM_AVAILABILITY_UUID",
"start_time": "LABOUR_CUSTOM_AVAILABILITY_START_TIME",
"end_time": "LABOUR_CUSTOM_AVAILABILITY_END_TIME",
"available": "LABOUR_CUSTOM_AVAILABILITY_AVAILABLE",
"preferred_day": "LABOUR_CUSTOM_AVAILABILITY_PREFERRED_DAY"
}
],
"labour_availability": [
{
"uuid": "LABOUR_AVAILABILITY_UUID",
"start_time": "LABOUR_AVAILABILITY_START_TIME",
"end_time": "LABOUR_AVAILABILITY_END_TIME",
"available": "LABOUR_AVAILABILITY_AVAILABLE",
"preferred_date": "LABOUR_AVAILABILITY_PREFERRED_DATE"
}
]
}
],
"pagination": {
"records": "PAGINATION_RECORDS",
"limit": "PAGINATION_LIMIT",
"offset": "PAGINATION_OFFSET",
"previous_page": "PAGINATION_PREVIOUS_PAGE",
"next_page": "PAGINATION_NEXT_PAGE"
}
}
Getting Labour Details
Function : get_labour()
Purpose
This function retrieves detailed information for a specific labour record identified by the labour UUID. It returns the complete labour profile including personal details, profile assignment, contact information, and custom availability schedules.
Parameters
| Parameter | Type | Description |
|---|---|---|
| labour-id | String | Unique identifier (UUID) of the labour record to retrieve. |
Use Case
This function is used when a user needs to view or verify the details of an individual labour resource. It is commonly used for reviewing labour profiles, checking availability schedules, validating contact information, or auditing labour data before assigning work or scheduling timesheets.
def test_get_labour():
SDKConfig.PRINT_REQUEST_DATA = True
SDKConfig.PRINT_RAW_RESPONSE = False
token_file_path = "shared_token.json"
file_token_mgr = FileTokenManager(token_file_path)
exsited_sdk: ExsitedSDK = ExsitedSDK().init_sdk(
request_token_dto=CommonData.get_request_token_dto(),
file_token_mgr=file_token_mgr
)
try:
labour_uuid = "YOUR_LABOUR_UUID"
response = exsited_sdk.labour.get_labour(labour_uuid)
print("Get Labour Response:")
print(response)
except ABException as ab:
print(ab)
print(ab.get_errors())
print(ab.raw_response)
public function testLabourDetails($labourUUID)
{
try {
echo "\n=== Testing Get Labour Details ===\n";
echo "UUID: {$labourUUID}\n";
$response = $this->labourService->details($labourUUID);
echo '<pre>' . json_encode($response, JSON_PRETTY_PRINT) . '</pre>';
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
}
Response
The function returns an object containing a single labour record. The response includes labour metadata such as status, UUID, labour code, name, display name, description, email address, labour profile details, custom form template, audit fields, custom attributes, contact information, and custom availability schedules by day and time.
LabourDetailsDTO(
labour=LabourDataDTO(
status='LABOUR_STATUS',
uuid='LABOUR_UUID',
code='LABOUR_CODE',
name='LABOUR_NAME',
displayName='LABOUR_DISPLAY_NAME',
description='LABOUR_DESCRIPTION',
imageName='LABOUR_IMAGE_NAME',
emailAddress='LABOUR_EMAIL_ADDRESS',
useCustomAvailability=LABOUR_USE_CUSTOM_AVAILABILITY,
labourProfile=LabourProfileDTO(
status='LABOUR_PROFILE_STATUS',
uuid='LABOUR_PROFILE_UUID',
name='LABOUR_PROFILE_NAME',
displayName='LABOUR_PROFILE_DISPLAY_NAME',
link='LABOUR_PROFILE_LINK'
),
customFormTemplate='LABOUR_CUSTOM_FORM_TEMPLATE',
createdBy='LABOUR_CREATED_BY',
createdOn='LABOUR_CREATED_ON',
lastUpdatedBy='LABOUR_LAST_UPDATED_BY',
lastUpdatedOn='LABOUR_LAST_UPDATED_ON',
customAttributes=[],
labourContacts=[
LabourContactDTO(
uuid='LABOUR_CONTACT_UUID',
contactType='LABOUR_CONTACT_TYPE',
value=LABOUR_CONTACT_VALUE,
isPrimary=LABOUR_CONTACT_IS_PRIMARY
)
],
labourCustomAvailability=[
LabourCustomAvailabilityDTO(
uuid='LABOUR_CUSTOM_AVAILABILITY_UUID',
startTime='LABOUR_CUSTOM_AVAILABILITY_START_TIME',
endTime='LABOUR_CUSTOM_AVAILABILITY_END_TIME',
available='LABOUR_CUSTOM_AVAILABILITY_AVAILABLE',
preferredDay='LABOUR_CUSTOM_AVAILABILITY_PREFERRED_DAY',
operation=LABOUR_CUSTOM_AVAILABILITY_OPERATION
)
]
)
)
{
"labour": {
"status": "LABOUR_STATUS",
"uuid": "LABOUR_UUID",
"code": "LABOUR_CODE",
"name": "LABOUR_NAME",
"display_name": "LABOUR_DISPLAY_NAME",
"description": "LABOUR_DESCRIPTION",
"image_name": "LABOUR_IMAGE_NAME",
"email_address": "LABOUR_EMAIL_ADDRESS",
"use_custom_availability": LABOUR_USE_CUSTOM_AVAILABILITY,
"labour_profile": {
"status": "LABOUR_PROFILE_STATUS",
"uuid": "LABOUR_PROFILE_UUID",
"name": "LABOUR_PROFILE_NAME",
"display_name": "LABOUR_PROFILE_DISPLAY_NAME",
"link": "LABOUR_PROFILE_LINK"
},
"custom_form_template": "LABOUR_CUSTOM_FORM_TEMPLATE",
"created_by": "LABOUR_CREATED_BY",
"created_on": "LABOUR_CREATED_ON",
"last_updated_by": "LABOUR_LAST_UPDATED_BY",
"last_updated_on": "LABOUR_LAST_UPDATED_ON",
"custom_attributes": [],
"labour_contacts": [
{
"status": "LABOUR_CONTACT_STATUS",
"uuid": "LABOUR_CONTACT_UUID",
"contact_type": "LABOUR_CONTACT_TYPE",
"salutation": "LABOUR_CONTACT_SALUTATION",
"designation": "LABOUR_CONTACT_DESIGNATION",
"first_name": "LABOUR_CONTACT_FIRST_NAME",
"last_name": "LABOUR_CONTACT_LAST_NAME",
"middle_name": "LABOUR_CONTACT_MIDDLE_NAME",
"email_address": "LABOUR_CONTACT_EMAIL",
"receive_email": "LABOUR_CONTACT_RECEIVE_EMAIL",
"phone": "LABOUR_CONTACT_PHONE",
"phone_area_code": "LABOUR_CONTACT_PHONE_AREA_CODE",
"phone_country_code": "LABOUR_CONTACT_PHONE_COUNTRY_CODE",
"do_not_phone": "LABOUR_CONTACT_DO_NOT_PHONE",
"fax": "LABOUR_CONTACT_FAX",
"fax_area_code": "LABOUR_CONTACT_FAX_AREA_CODE",
"fax_country_code": "LABOUR_CONTACT_FAX_COUNTRY_CODE",
"do_not_fax": "LABOUR_CONTACT_DO_NOT_FAX",
"mobile": "LABOUR_CONTACT_MOBILE",
"mobile_area_code": "LABOUR_CONTACT_MOBILE_AREA_CODE",
"mobile_country_code": "LABOUR_CONTACT_MOBILE_COUNTRY_CODE",
"do_not_mobile": "LABOUR_CONTACT_DO_NOT_MOBILE",
"country": "LABOUR_CONTACT_COUNTRY",
"state": "LABOUR_CONTACT_STATE",
"city": "LABOUR_CONTACT_CITY",
"post_code": "LABOUR_CONTACT_POST_CODE"
}
],
"labour_custom_availability": [
{
"uuid": "LABOUR_CUSTOM_AVAILABILITY_UUID",
"start_time": "LABOUR_CUSTOM_AVAILABILITY_START_TIME",
"end_time": "LABOUR_CUSTOM_AVAILABILITY_END_TIME",
"available": "LABOUR_CUSTOM_AVAILABILITY_AVAILABLE",
"preferred_day": "LABOUR_CUSTOM_AVAILABILITY_PREFERRED_DAY"
}
],
"labour_availability": [
{
"uuid": "LABOUR_AVAILABILITY_UUID",
"start_time": "LABOUR_AVAILABILITY_START_TIME",
"end_time": "LABOUR_AVAILABILITY_END_TIME",
"available": "LABOUR_AVAILABILITY_AVAILABLE",
"preferred_date": "LABOUR_AVAILABILITY_PREFERRED_DATE"
}
]
}
}
Creating Labour
Function : create_labour()
Purpose
This function creates a new labour record in the system. A labour record represents a workforce resource and includes profile information, contact details, availability configuration, and related metadata.
Parameters
This function does not require any input parameters.
Use Case
This function is used when a new labour resource needs to be added to the system. Typical scenarios include onboarding new workers, contractors, or contributors, defining their labour profile, setting custom availability schedules, and preparing them for assignment to jobs, orders, or timesheets.
def test_create_labour():
SDKConfig.PRINT_REQUEST_DATA = True
SDKConfig.PRINT_RAW_RESPONSE = False
token_file_path = "shared_token.json"
file_token_mgr = FileTokenManager(token_file_path)
exsited_sdk: ExsitedSDK = ExsitedSDK().init_sdk(
request_token_dto=CommonData.get_request_token_dto(),
file_token_mgr=file_token_mgr
)
try:
request_data = LabourCreateDTO(
labour=LabourRequestDataDTO(
name="LABOUR_NAME",
displayName="LABOUR_DISPLAY_NAME",
description="LABOUR_DESCRIPTION",
imageName="",
emailAddress="LABOUR_EMAIL",
useCustomAvailability=True,
labourProfile="LABOUR_PROFILE",
customFormTemplate="Default for Labour",
labourCustomAvailability=[
LabourCustomAvailabilityDTO(
startTime="START_TIME",
endTime="END_TIME",
available="true",
preferredDay="DAY_1"
),
LabourCustomAvailabilityDTO(
startTime="START_TIME",
endTime="END_TIME",
available="true",
preferredDay="DAY_2"
)
]
)
)
response = exsited_sdk.labour.create_labour(request_data=request_data)
print("Create Labour Response:")
print(response)
except ABException as ab:
print(ab)
print(ab.get_errors())
print(ab.raw_response)
public function testLabourCreate()
{
try {
echo "\n=== Testing Create Labour ===\n";
$params = [
"labour" => [
"name" => "LABOUR_NAME",
"display_name" => "LABOUR_DISPLAY_NAME",
"description" => "LABOUR_DESCRIPTION",
"image_name" => "",
"email_address" => "LABOUR_EMAIL",
"use_custom_availability" => true,
"labour_profile" => "LABOUR_PROFILE",
"custom_form_template" => "Default for Labour",
"labour_custom_availability" => [
[
"start_time" => "START_TIME",
"end_time" => "END_TIME",
"available" => "true",
"preferred_day" => "DAY_1"
],
[
"start_time" => "START_TIME",
"end_time" => "END_TIME",
"available" => "true",
"preferred_day" => "DAY_2"
]
]
]
];
echo "Request Data:\n";
echo '<pre>' . json_encode($params, JSON_PRETTY_PRINT) . '</pre>';
$response = $this->labourService->create($params);
echo "\nResponse:\n";
echo '<pre>' . json_encode($response, JSON_PRETTY_PRINT) . '</pre>';
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
}
Response
The function returns an object containing the created labour record. The response includes labour details such as status, UUID, labour code, name, display name, description, email address, labour profile reference, custom form template, audit fields (created and last updated information), custom attributes, contact details, and any configured custom availability schedules.
LabourDetailsDTO(
labour=LabourDataDTO(
status=LABOUR_STATUS,
uuid=LABOUR_UUID,
code=LABOUR_CODE,
name=LABOUR_NAME,
displayName=LABOUR_DISPLAY_NAME,
description=LABOUR_DESCRIPTION,
imageName=LABOUR_IMAGE_NAME,
emailAddress=LABOUR_EMAIL_ADDRESS,
useCustomAvailability=LABOUR_USE_CUSTOM_AVAILABILITY,
labourProfile=LABOUR_PROFILE,
customFormTemplate=LABOUR_CUSTOM_FORM_TEMPLATE,
createdBy=LABOUR_CREATED_BY,
createdOn=LABOUR_CREATED_ON,
lastUpdatedBy=LABOUR_LAST_UPDATED_BY,
lastUpdatedOn=LABOUR_LAST_UPDATED_ON,
customAttributes=LABOUR_CUSTOM_ATTRIBUTES,
labourContacts=LABOUR_CONTACTS,
labourCustomAvailability=LABOUR_CUSTOM_AVAILABILITY
)
)
{
"labour": {
"labour": {
"status": "LABOUR_STATUS",
"uuid": "LABOUR_UUID",
"code": "LABOUR_CODE",
"name": "LABOUR_NAME",
"display_name": "LABOUR_DISPLAY_NAME",
"description": "LABOUR_DESCRIPTION",
"image_name": "LABOUR_IMAGE_NAME",
"email_address": "LABOUR_EMAIL_ADDRESS",
"use_custom_availability": LABOUR_USE_CUSTOM_AVAILABILITY,
"labour_profile": {
"status": "LABOUR_PROFILE_STATUS",
"uuid": "LABOUR_PROFILE_UUID",
"name": "LABOUR_PROFILE_NAME",
"display_name": "LABOUR_PROFILE_DISPLAY_NAME",
"link": "LABOUR_PROFILE_LINK"
},
"custom_form_template": "LABOUR_CUSTOM_FORM_TEMPLATE",
"created_by": "LABOUR_CREATED_BY",
"created_on": "LABOUR_CREATED_ON",
"last_updated_by": "LABOUR_LAST_UPDATED_BY",
"last_updated_on": "LABOUR_LAST_UPDATED_ON",
"custom_attributes": [],
"labour_contacts": [],
"labour_custom_availability": [
{
"uuid": "LABOUR_CUSTOM_AVAILABILITY_UUID",
"start_time": "START_TIME",
"end_time": "END_TIME",
"available": "AVAILABILITY_FLAG",
"preferred_day": "PREFERRED_DAY"
}
],
"labour_availability": []
},
"activity_logs": []
}
}
Updating Labour
Function: update_labour()
Purpose
This function updates an existing labour record identified by its UUID. It allows modification of labour details such as name, display name, and description.
Parameters
| Parameter name | Type | Required | Description |
|---|---|---|---|
| labours-uuid | String | Yes | The unique UUID of the labour record that needs to be updated. |
Use Case
This function is used when existing labour information needs to be updated. Typical use cases include correcting labour details, updating display names, or maintaining accurate records after operational changes.
def test_update_labour():
SDKConfig.PRINT_REQUEST_DATA = True
SDKConfig.PRINT_RAW_RESPONSE = False
token_file_path = "shared_token.json"
file_token_mgr = FileTokenManager(token_file_path)
exsited_sdk: ExsitedSDK = ExsitedSDK().init_sdk(
request_token_dto=CommonData.get_request_token_dto(),
file_token_mgr=file_token_mgr
)
try:
labour_uuid = "LABOUR_UUID"
request_data = LabourUpdateDTO(
labour=LabourRequestDataDTO(
name="LABOUR_NAME",
displayName="LABOUR_DISPLAY_NAME",
description="LABOUR_DESCRIPTION"
)
)
response = exsited_sdk.labour.update_labour(labour_uuid, request_data)
print("Update Labour Response:")
print(response)
except ABException as ab:
print(ab)
print(ab.get_errors())
print(ab.raw_response)
public function testLabourUpdate($labourUUID)
{
try {
echo "\n=== Testing Update Labour ===\n";
echo "UUID: {$labourUUID}\n";
$params = [
"labour" => [
"name" => "LABOUR_NAME",
"display_name" => "LABOUR_DISPLAY_NAME",
"description" => "LABOUR_DESCRIPTION"
]
];
echo "Request Data:\n";
echo '<pre>' . json_encode($params, JSON_PRETTY_PRINT) . '</pre>';
$response = $this->labourService->update($labourUUID, $params);
echo "\nResponse:\n";
echo '<pre>' . json_encode($response, JSON_PRETTY_PRINT) . '</pre>';
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
}
Response
The function returns an object containing the updated labour details. The response includes the labour’s status, UUID, labour code, name, display name, description, email address, labour profile details, custom form template, audit information (created and last updated fields), contact details, and custom availability configuration.
LabourDetailsDTO(
labour=LabourDataDTO(
status='LABOUR_STATUS',
uuid='LABOUR_UUID',
code='LABOUR_CODE',
name='LABOUR_NAME',
displayName='LABOUR_DISPLAY_NAME',
description='LABOUR_DESCRIPTION',
imageName='LABOUR_IMAGE_NAME',
emailAddress='LABOUR_EMAIL_ADDRESS',
useCustomAvailability=LABOUR_USE_CUSTOM_AVAILABILITY,
labourProfile=LabourProfileDTO(
status='LABOUR_PROFILE_STATUS',
uuid='LABOUR_PROFILE_UUID',
name='LABOUR_PROFILE_NAME',
displayName='LABOUR_PROFILE_DISPLAY_NAME',
link='LABOUR_PROFILE_LINK'
),
customFormTemplate='LABOUR_CUSTOM_FORM_TEMPLATE',
createdBy='LABOUR_CREATED_BY',
createdOn='LABOUR_CREATED_ON',
lastUpdatedBy='LABOUR_LAST_UPDATED_BY',
lastUpdatedOn='LABOUR_LAST_UPDATED_ON',
customAttributes=[],
labourContacts=[
LabourContactDTO(
uuid='LABOUR_CONTACT_UUID',
contactType='LABOUR_CONTACT_TYPE',
value=LABOUR_CONTACT_VALUE,
isPrimary=LABOUR_CONTACT_IS_PRIMARY
)
],
labourCustomAvailability=[
LabourCustomAvailabilityDTO(
uuid='LABOUR_CUSTOM_AVAILABILITY_UUID',
startTime='START_TIME',
endTime='END_TIME',
available='AVAILABILITY_FLAG',
preferredDay='PREFERRED_DAY',
operation=LABOUR_CUSTOM_AVAILABILITY_OPERATION
)
]
)
)
{
"labour": {
"status": "LABOUR_STATUS",
"uuid": "LABOUR_UUID",
"code": "LABOUR_CODE",
"name": "LABOUR_NAME",
"display_name": "LABOUR_DISPLAY_NAME",
"description": "LABOUR_DESCRIPTION",
"image_name": "LABOUR_IMAGE_NAME",
"email_address": "LABOUR_EMAIL_ADDRESS",
"use_custom_availability": LABOUR_USE_CUSTOM_AVAILABILITY,
"labour_profile": {
"status": "LABOUR_PROFILE_STATUS",
"uuid": "LABOUR_PROFILE_UUID",
"name": "LABOUR_PROFILE_NAME",
"display_name": "LABOUR_PROFILE_DISPLAY_NAME",
"link": "LABOUR_PROFILE_LINK"
},
"custom_form_template": "LABOUR_CUSTOM_FORM_TEMPLATE",
"created_by": "LABOUR_CREATED_BY",
"created_on": "LABOUR_CREATED_ON",
"last_updated_by": "LABOUR_LAST_UPDATED_BY",
"last_updated_on": "LABOUR_LAST_UPDATED_ON",
"custom_attributes": [],
"labour_contacts": [
{
"status": "LABOUR_CONTACT_STATUS",
"uuid": "LABOUR_CONTACT_UUID",
"contact_type": "LABOUR_CONTACT_TYPE",
"salutation": "LABOUR_CONTACT_SALUTATION",
"designation": "LABOUR_CONTACT_DESIGNATION",
"first_name": "LABOUR_CONTACT_FIRST_NAME",
"last_name": "LABOUR_CONTACT_LAST_NAME",
"middle_name": "LABOUR_CONTACT_MIDDLE_NAME",
"email_address": "LABOUR_CONTACT_EMAIL",
"receive_email": "LABOUR_CONTACT_RECEIVE_EMAIL",
"phone": "LABOUR_CONTACT_PHONE",
"phone_area_code": "LABOUR_CONTACT_PHONE_AREA_CODE",
"phone_country_code": "LABOUR_CONTACT_PHONE_COUNTRY_CODE",
"do_not_phone": "LABOUR_CONTACT_DO_NOT_PHONE",
"fax": "LABOUR_CONTACT_FAX",
"fax_area_code": "LABOUR_CONTACT_FAX_AREA_CODE",
"fax_country_code": "LABOUR_CONTACT_FAX_COUNTRY_CODE",
"do_not_fax": "LABOUR_CONTACT_DO_NOT_FAX",
"mobile": "LABOUR_CONTACT_MOBILE",
"mobile_area_code": "LABOUR_CONTACT_MOBILE_AREA_CODE",
"mobile_country_code": "LABOUR_CONTACT_MOBILE_COUNTRY_CODE",
"do_not_mobile": "LABOUR_CONTACT_DO_NOT_MOBILE",
"country": "LABOUR_CONTACT_COUNTRY",
"state": "LABOUR_CONTACT_STATE",
"city": "LABOUR_CONTACT_CITY",
"post_code": "LABOUR_CONTACT_POST_CODE"
}
],
"labour_custom_availability": [
{
"uuid": "LABOUR_CUSTOM_AVAILABILITY_UUID",
"start_time": "START_TIME",
"end_time": "END_TIME",
"available": "AVAILABILITY_FLAG",
"preferred_day": "PREFERRED_DAY"
}
],
"labour_availability": [
{
"uuid": "LABOUR_AVAILABILITY_UUID",
"start_time": "START_TIME",
"end_time": "END_TIME",
"available": "AVAILABILITY_FLAG",
"preferred_date": "PREFERRED_DATE"
}
],
"activity_logs": []
}
}
Deleting Labour
Function: delete_labour()
Purpose
This function deletes an existing labour record from the system. Once deleted, the labour record is no longer available for scheduling, assignment, or reporting.
Parameters
| Parameter name | Type | Required | Description |
|---|---|---|---|
| labours-uuid | String | Yes | The unique UUID of the labour record to be deleted. |
Use Case
This function is used when a labour resource is no longer required in the system, such as when a contractor leaves, a duplicate record is identified, or outdated labour data needs to be permanently removed.
def test_delete_labour():
SDKConfig.PRINT_REQUEST_DATA = True
SDKConfig.PRINT_RAW_RESPONSE = False
token_file_path = "shared_token.json"
file_token_mgr = FileTokenManager(token_file_path)
exsited_sdk: ExsitedSDK = ExsitedSDK().init_sdk(
request_token_dto=CommonData.get_request_token_dto(),
file_token_mgr=file_token_mgr
)
try:
labour_uuid = "YOUR_LABOUR_UUID"
response = exsited_sdk.labour.delete_labour(labour_uuid)
print("Delete Labour Response:")
print(f"Deletion successful: {response}")
except ABException as ab:
print(ab)
print(ab.get_errors())
print(ab.raw_response)
public function testLabourDelete($labourUUID)
{
try {
echo "\n=== Testing Delete Labour ===\n";
echo "UUID: {$labourUUID}\n";
$response = $this->labourService->delete($labourUUID);
echo "\nResponse:\n";
echo '<pre>' . json_encode($response, JSON_PRETTY_PRINT) . '</pre>';
$responseArray = is_object($response) ? (array)$response : $response;
if (empty($responseArray) || (isset($responseArray['status']) && $responseArray['status'] == 204)) {
echo "\n✓ Labour deleted successfully (204 No Content)\n";
}
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
}
Response
The function returns a success response with an HTTP status code 204 (No Content), indicating that the labour record has been successfully deleted.
{'SUCCESS': TRUE, 'STATUS_CODE': 204}
null
Getting Labour Profile List
Function: labour_profile_list()
Purpose
This function retrieves a paginated list of labour profiles available in the system. Labour profiles define the role, category, or type of labour (for example, Painter, General Labour, Helper) and are used when creating, assigning, and managing labour resources.
Parameters
| Parameter | Type | Description |
|---|---|---|
| limit | Integer | Number of labour profile records to retrieve per page. |
| offset | Integer | Number of records to skip from the beginning of the result set. |
| records | Integer | Total number of records returned in the current response. |
| previous_page | String | URL for the previous page of results, if available. |
| next_page | String | URL for the next page of results, if available. |
Use Case
This function is used when administrators or managers need to view, select, or manage labour profiles. It is commonly used during labour creation or updates to assign the correct profile, and for reviewing available labour roles configured in the system. Pagination ensures efficient handling of large numbers of labour profiles.
def test_labour_profile_list():
SDKConfig.PRINT_REQUEST_DATA = True
SDKConfig.PRINT_RAW_RESPONSE = False
token_file_path = "shared_token.json"
file_token_mgr = FileTokenManager(token_file_path)
exsited_sdk: ExsitedSDK = ExsitedSDK().init_sdk(
request_token_dto=CommonData.get_request_token_dto(),
file_token_mgr=file_token_mgr
)
try:
response = exsited_sdk.labour.labour_profile_list(limit=10, offset=0)
print(response)
except ABException as ab:
print(ab)
print(ab.get_errors())
print(ab.raw_response)
public function testLabourProfileListAll()
{
try {
echo "\n=== Testing List All Labour Profiles ===\n";
$response = $this->labourProfileService->listAll();
echo '<pre>' . json_encode($response, JSON_PRETTY_PRINT) . '</pre>';
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
}
Response
The function returns an object containing a list of labour profiles. Each profile includes details such as status, UUID, profile name, display name, and reference links. Pagination details are also included, allowing navigation through multiple pages of labour profile records.
LabourProfileListDTO(
labourProfiles=[
LabourProfileDataDTO(
status='LABOUR_PROFILE_STATUS',
uuid='LABOUR_PROFILE_UUID',
code='LABOUR_PROFILE_CODE',
name='LABOUR_PROFILE_NAME',
displayName='LABOUR_PROFILE_DISPLAY_NAME',
description='LABOUR_PROFILE_DESCRIPTION',
imageName='LABOUR_PROFILE_IMAGE_NAME',
customFormTemplate='LABOUR_PROFILE_CUSTOM_FORM_TEMPLATE',
labourProfileAvailability='LABOUR_PROFILE_AVAILABILITY',
createdBy='LABOUR_PROFILE_CREATED_BY',
createdOn='LABOUR_PROFILE_CREATED_ON',
lastUpdatedBy='LABOUR_PROFILE_LAST_UPDATED_BY',
lastUpdatedOn='LABOUR_PROFILE_LAST_UPDATED_ON'
)
]
)
{
"labour_profiles": [
{
"status": "LABOUR_PROFILE_STATUS",
"uuid": "LABOUR_PROFILE_UUID",
"name": "LABOUR_PROFILE_NAME",
"display_name": "LABOUR_PROFILE_DISPLAY_NAME",
"max_booking_limit": "LABOUR_PROFILE_MAX_BOOKING_LIMIT",
"tax_inclusive": "LABOUR_PROFILE_TAX_INCLUSIVE",
"currency": "LABOUR_PROFILE_CURRENCY",
"tax": {
"uuid": "TAX_UUID",
"code": "TAX_CODE",
"rate": "TAX_RATE",
"link": "TAX_LINK"
},
"created_by": "LABOUR_PROFILE_CREATED_BY",
"created_on": "LABOUR_PROFILE_CREATED_ON",
"last_updated_by": "LABOUR_PROFILE_LAST_UPDATED_BY",
"last_updated_on": "LABOUR_PROFILE_LAST_UPDATED_ON",
"labours": [
{
"status": "LABOUR_STATUS",
"uuid": "LABOUR_UUID",
"name": "LABOUR_NAME",
"display_name": "LABOUR_DISPLAY_NAME",
"image_name": "LABOUR_IMAGE_NAME",
"use_custom_availability": "LABOUR_USE_CUSTOM_AVAILABILITY",
"link": "LABOUR_LINK"
}
],
"labour_profile_sessions": [
{
"status": "SESSION_STATUS",
"uuid": "SESSION_UUID",
"name": "SESSION_NAME",
"start_date": "SESSION_START_DATE",
"end_date": "SESSION_END_DATE",
"labour_profile_session_prices": [
{
"id": "SESSION_PRICE_ID",
"status": "SESSION_PRICE_STATUS",
"uuid": "SESSION_PRICE_UUID",
"price": "SESSION_PRICE",
"enabled_pro_rata": "SESSION_PRICE_ENABLED_PRO_RATA",
"price_type": "SESSION_PRICE_TYPE",
"pricing_level": "SESSION_PRICE_PRICING_LEVEL",
"labour_profile_session_price_hours": [
{
"status": "PRICE_HOUR_STATUS",
"uuid": "PRICE_HOUR_UUID",
"start_time": "PRICE_HOUR_START_TIME",
"end_time": "PRICE_HOUR_END_TIME",
"price": "PRICE_HOUR_PRICE"
}
]
}
],
"labour_profile_session_availability": [
{
"status": "SESSION_AVAILABILITY_STATUS",
"uuid": "SESSION_AVAILABILITY_UUID",
"start_time": "SESSION_AVAILABILITY_START_TIME",
"end_time": "SESSION_AVAILABILITY_END_TIME",
"available": "SESSION_AVAILABILITY_AVAILABLE",
"preferred_day": "SESSION_AVAILABILITY_PREFERRED_DAY"
}
],
"labour_profile_session_working_hours": [
{
"status": "WORKING_HOUR_STATUS",
"uuid": "WORKING_HOUR_UUID",
"start_time": "WORKING_HOUR_START_TIME",
"end_time": "WORKING_HOUR_END_TIME"
}
]
}
]
}
],
"pagination": {
"records": "PAGINATION_RECORDS",
"limit": "PAGINATION_LIMIT",
"offset": "PAGINATION_OFFSET",
"previous_page": "PAGINATION_PREVIOUS_PAGE",
"next_page": "PAGINATION_NEXT_PAGE"
}
}
Getting Labour Profile Details
Function: labour_profile_details()
Purpose
This function retrieves detailed information about a specific labour profile using its unique UUID. A labour profile represents a predefined role or category of labour and contains metadata used across labour management workflows.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| profile-uuid | String | Yes | The unique UUID of the labour profile to retrieve. |
Use Case
This function is used when detailed information about a specific labour profile is required. Common scenarios include validating a labour profile before assigning it to a labour record, reviewing profile configuration, or displaying profile details in administrative or configuration screens.
def test_labour_profile_details():
SDKConfig.PRINT_REQUEST_DATA = True
SDKConfig.PRINT_RAW_RESPONSE = False
token_file_path = "shared_token.json"
file_token_mgr = FileTokenManager(token_file_path)
exsited_sdk: ExsitedSDK = ExsitedSDK().init_sdk(
request_token_dto=CommonData.get_request_token_dto(),
file_token_mgr=file_token_mgr
)
try:
response = exsited_sdk.labour.labour_profile_details(uuid="YOUR_PROFILE_UUID")
print(response)
except ABException as ab:
print(ab)
print(ab.get_errors())
print(ab.raw_response)
public function testLabourProfileDetails($profileUUID)
{
try {
echo "\n=== Testing Get Labour Profile Details ===\n";
echo "UUID: {$profileUUID}\n";
$response = $this->labourProfileService->details($profileUUID);
echo '<pre>' . json_encode($response, JSON_PRETTY_PRINT) . '</pre>';
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
}
Response
The function returns an object containing labour profile details. The response includes information such as profile status, UUID, name, display name, description, associated custom form template, availability configuration (if any), and audit fields including created by, created on, last updated by, and last updated on.
LabourProfileDetailsDTO(
labourProfile=LabourProfileDataDTO(
status='LABOUR_PROFILE_STATUS',
uuid='LABOUR_PROFILE_UUID',
code='LABOUR_PROFILE_CODE',
name='LABOUR_PROFILE_NAME',
displayName='LABOUR_PROFILE_DISPLAY_NAME',
description='LABOUR_PROFILE_DESCRIPTION',
imageName='LABOUR_PROFILE_IMAGE_NAME',
customFormTemplate='LABOUR_PROFILE_CUSTOM_FORM_TEMPLATE',
labourProfileAvailability='LABOUR_PROFILE_AVAILABILITY',
createdBy='LABOUR_PROFILE_CREATED_BY',
createdOn='LABOUR_PROFILE_CREATED_ON',
lastUpdatedBy='LABOUR_PROFILE_LAST_UPDATED_BY',
lastUpdatedOn='LABOUR_PROFILE_LAST_UPDATED_ON'
)
)
{
"labour_profile": {
"status": "LABOUR_PROFILE_STATUS",
"uuid": "LABOUR_PROFILE_UUID",
"name": "LABOUR_PROFILE_NAME",
"display_name": "LABOUR_PROFILE_DISPLAY_NAME",
"max_booking_limit": "LABOUR_PROFILE_MAX_BOOKING_LIMIT",
"tax_inclusive": "LABOUR_PROFILE_TAX_INCLUSIVE",
"currency": "LABOUR_PROFILE_CURRENCY",
"tax": {
"uuid": "TAX_UUID",
"code": "TAX_CODE",
"rate": "TAX_RATE",
"link": "TAX_LINK"
},
"created_by": "LABOUR_PROFILE_CREATED_BY",
"created_on": "LABOUR_PROFILE_CREATED_ON",
"last_updated_by": "LABOUR_PROFILE_LAST_UPDATED_BY",
"last_updated_on": "LABOUR_PROFILE_LAST_UPDATED_ON",
"labours": [
{
"status": "LABOUR_STATUS",
"uuid": "LABOUR_UUID",
"name": "LABOUR_NAME",
"display_name": "LABOUR_DISPLAY_NAME",
"image_name": "LABOUR_IMAGE_NAME",
"use_custom_availability": "LABOUR_USE_CUSTOM_AVAILABILITY",
"link": "LABOUR_LINK"
}
],
"labour_profile_sessions": [
{
"status": "SESSION_STATUS",
"uuid": "SESSION_UUID",
"name": "SESSION_NAME",
"start_date": "SESSION_START_DATE",
"end_date": "SESSION_END_DATE",
"labour_profile_session_prices": [
{
"id": "SESSION_PRICE_ID",
"status": "SESSION_PRICE_STATUS",
"uuid": "SESSION_PRICE_UUID",
"price": "SESSION_PRICE",
"enabled_pro_rata": "SESSION_PRICE_ENABLED_PRO_RATA",
"price_type": "SESSION_PRICE_TYPE",
"pricing_level": "SESSION_PRICE_PRICING_LEVEL",
"labour_profile_session_price_hours": [
{
"status": "PRICE_HOUR_STATUS",
"uuid": "PRICE_HOUR_UUID",
"start_time": "PRICE_HOUR_START_TIME",
"end_time": "PRICE_HOUR_END_TIME",
"price": "PRICE_HOUR_PRICE"
}
]
}
],
"labour_profile_session_availability": [
{
"status": "SESSION_AVAILABILITY_STATUS",
"uuid": "SESSION_AVAILABILITY_UUID",
"start_time": "SESSION_AVAILABILITY_START_TIME",
"end_time": "SESSION_AVAILABILITY_END_TIME",
"available": "SESSION_AVAILABILITY_AVAILABLE",
"preferred_day": "SESSION_AVAILABILITY_PREFERRED_DAY"
}
],
"labour_profile_session_working_hours": [
{
"status": "WORKING_HOUR_STATUS",
"uuid": "WORKING_HOUR_UUID",
"start_time": "WORKING_HOUR_START_TIME",
"end_time": "WORKING_HOUR_END_TIME"
}
]
}
]
}
}
Creating Labour Profile
Function: labour_profile_create()
Purpose
This function creates a new labour profile in the system. A labour profile defines the role, availability rules, sessions, pricing structure, and working hours that can later be assigned to one or more labour resources.
Parameters
This function does not require any input parameters.
Use Case
This function is used when setting up new labour roles within the system. Typical scenarios include creating profiles for different job roles (such as Helper, Painter, or Electrician), defining availability schedules, configuring pricing and working hours, and preparing profiles to be assigned to labour resources for booking, scheduling, and billing workflows.
def test_labour_profile_create():
SDKConfig.PRINT_REQUEST_DATA = True
SDKConfig.PRINT_RAW_RESPONSE = False
token_file_path = "shared_token.json"
file_token_mgr = FileTokenManager(token_file_path)
exsited_sdk: ExsitedSDK = ExsitedSDK().init_sdk(
request_token_dto=CommonData.get_request_token_dto(),
file_token_mgr=file_token_mgr
)
try:
request_data = LabourProfileCreateDTO(
labourProfile=LabourProfileRequestDataDTO(
name="LABOUR_PROFILE_NAME",
displayName="LABOUR_PROFILE_DISPLAY_NAME",
description="LABOUR_PROFILE_DESCRIPTION",
labourProfileAvailability=[
LabourProfileAvailabilityDTO(
startTime="START_TIME",
endTime="END_TIME",
available="true",
preferredDay="PREFERRED_DAY"
)
]
)
)
response = exsited_sdk.labour.labour_profile_create(request_data=request_data)
print(response)
except ABException as ab:
print(ab)
print(ab.get_errors())
print(ab.raw_response)
public function testLabourProfileCreate()
{
try {
echo "\n=== Testing Create Labour Profile ===\n";
$params = [
"labour_profile" => [
"name" => "LABOUR_PROFILE_NAME",
"display_name" => "LABOUR_PROFILE_DISPLAY_NAME",
"max_booking_limit" => "MAX_BOOKING_LIMIT",
"currency" => "CURRENCY_CODE",
"tax_inclusive" => true,
"labour_profile_sessions" => [
[
"name" => "SESSION_NAME",
"start_date" => "SESSION_START_DATE",
"end_date" => "SESSION_END_DATE",
"labour_profile_session_prices" => [
[
"price" => "BASE_PRICE",
"enabled_pro_rata" => false,
"price_type" => "PRICE_TYPE",
"labour_profile_session_price_hours" => [
[
"start_time" => "START_TIME",
"end_time" => "END_TIME",
"price" => "HOURLY_PRICE"
]
],
"labour_profile_session_price_peak_hourly" => [
[
"start_time" => "PEAK_START_TIME",
"end_time" => "PEAK_END_TIME",
"price" => "PEAK_PRICE",
"price_type" => "PEAK_PRICE_TYPE"
]
]
]
],
"labour_profile_session_availability" => [
["preferred_day" => "DAY_1", "available" => true, "start_time" => "START_TIME", "end_time" => "END_TIME"],
["preferred_day" => "DAY_2", "available" => true, "start_time" => "START_TIME", "end_time" => "END_TIME"],
["preferred_day" => "DAY_3", "available" => true, "start_time" => "START_TIME", "end_time" => "END_TIME"],
["preferred_day" => "DAY_4", "available" => true, "start_time" => "START_TIME", "end_time" => "END_TIME"],
["preferred_day" => "DAY_5", "available" => true, "start_time" => "START_TIME", "end_time" => "END_TIME"],
["preferred_day" => "DAY_6", "available" => true, "start_time" => "START_TIME", "end_time" => "END_TIME"],
["preferred_day" => "DAY_7", "available" => true, "start_time" => "START_TIME", "end_time" => "END_TIME"]
]
]
]
]
];
echo "Request Data:\n";
echo '<pre>' . json_encode($params, JSON_PRETTY_PRINT) . '</pre>';
$response = $this->labourProfileService->create($params);
echo "\nResponse:\n";
echo '<pre>' . json_encode($response, JSON_PRETTY_PRINT) . '</pre>';
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
}
Response
The function returns an object containing the newly created labour profile details. The response includes the profile’s status, UUID, name, display name, tax and currency information, audit fields, and associated data such as labour profile sessions, session pricing, availability schedules, and working hours. This confirms that the labour profile has been successfully created and is ready for use in the system.
{
"labour_profile": {
"status": "LABOUR_PROFILE_STATUS",
"uuid": "LABOUR_PROFILE_UUID",
"name": "LABOUR_PROFILE_NAME",
"display_name": "LABOUR_PROFILE_DISPLAY_NAME",
"max_booking_limit": "LABOUR_PROFILE_MAX_BOOKING_LIMIT",
"tax_inclusive": "LABOUR_PROFILE_TAX_INCLUSIVE",
"currency": "LABOUR_PROFILE_CURRENCY",
"tax": {
"uuid": "TAX_UUID",
"code": "TAX_CODE",
"rate": "TAX_RATE",
"link": "TAX_LINK"
},
"created_by": "LABOUR_PROFILE_CREATED_BY",
"created_on": "LABOUR_PROFILE_CREATED_ON",
"last_updated_by": "LABOUR_PROFILE_LAST_UPDATED_BY",
"last_updated_on": "LABOUR_PROFILE_LAST_UPDATED_ON",
"labours": [],
"labour_profile_sessions": [
{
"status": "SESSION_STATUS",
"uuid": "SESSION_UUID",
"name": "SESSION_NAME",
"start_date": "SESSION_START_DATE",
"end_date": "SESSION_END_DATE",
"labour_profile_session_prices": [
{
"id": "SESSION_PRICE_ID",
"status": "SESSION_PRICE_STATUS",
"uuid": "SESSION_PRICE_UUID",
"price": "SESSION_PRICE",
"enabled_pro_rata": "SESSION_ENABLED_PRO_RATA",
"price_type": "SESSION_PRICE_TYPE",
"pricing_level": "SESSION_PRICING_LEVEL",
"labour_profile_session_price_hours": [
{
"status": "PRICE_HOUR_STATUS",
"uuid": "PRICE_HOUR_UUID",
"start_time": "PRICE_HOUR_START_TIME",
"end_time": "PRICE_HOUR_END_TIME",
"price": "PRICE_HOUR_PRICE"
}
]
}
],
"labour_profile_session_availability": [
{
"status": "AVAILABILITY_STATUS",
"uuid": "AVAILABILITY_UUID",
"start_time": "AVAILABILITY_START_TIME",
"end_time": "AVAILABILITY_END_TIME",
"available": "AVAILABILITY_AVAILABLE",
"preferred_day": "AVAILABILITY_PREFERRED_DAY"
}
],
"labour_profile_session_working_hours": [
{
"status": "WORKING_HOURS_STATUS",
"uuid": "WORKING_HOURS_UUID",
"start_time": "WORKING_HOURS_START_TIME",
"end_time": "WORKING_HOURS_END_TIME"
}
]
}
]
}
}
{
"labour_profile": {
"status": "LABOUR_PROFILE_STATUS",
"uuid": "LABOUR_PROFILE_UUID",
"name": "LABOUR_PROFILE_NAME",
"display_name": "LABOUR_PROFILE_DISPLAY_NAME",
"max_booking_limit": "LABOUR_PROFILE_MAX_BOOKING_LIMIT",
"tax_inclusive": "LABOUR_PROFILE_TAX_INCLUSIVE",
"currency": "LABOUR_PROFILE_CURRENCY",
"tax": {
"uuid": "TAX_UUID",
"code": "TAX_CODE",
"rate": "TAX_RATE",
"link": "TAX_LINK"
},
"created_by": "LABOUR_PROFILE_CREATED_BY",
"created_on": "LABOUR_PROFILE_CREATED_ON",
"last_updated_by": "LABOUR_PROFILE_LAST_UPDATED_BY",
"last_updated_on": "LABOUR_PROFILE_LAST_UPDATED_ON",
"labours": [],
"labour_profile_sessions": [
{
"status": "SESSION_STATUS",
"uuid": "SESSION_UUID",
"name": "SESSION_NAME",
"start_date": "SESSION_START_DATE",
"end_date": "SESSION_END_DATE",
"labour_profile_session_prices": [
{
"id": "SESSION_PRICE_ID",
"status": "SESSION_PRICE_STATUS",
"uuid": "SESSION_PRICE_UUID",
"price": "SESSION_PRICE",
"enabled_pro_rata": "SESSION_ENABLED_PRO_RATA",
"price_type": "SESSION_PRICE_TYPE",
"pricing_level": "SESSION_PRICING_LEVEL",
"labour_profile_session_price_hours": [
{
"status": "PRICE_HOUR_STATUS",
"uuid": "PRICE_HOUR_UUID",
"start_time": "PRICE_HOUR_START_TIME",
"end_time": "PRICE_HOUR_END_TIME",
"price": "PRICE_HOUR_PRICE"
}
]
}
],
"labour_profile_session_availability": [
{
"status": "AVAILABILITY_STATUS",
"uuid": "AVAILABILITY_UUID",
"start_time": "AVAILABILITY_START_TIME",
"end_time": "AVAILABILITY_END_TIME",
"available": "AVAILABILITY_AVAILABLE",
"preferred_day": "AVAILABILITY_PREFERRED_DAY"
}
],
"labour_profile_session_working_hours": [
{
"status": "WORKING_HOURS_STATUS",
"uuid": "WORKING_HOURS_UUID",
"start_time": "WORKING_HOURS_START_TIME",
"end_time": "WORKING_HOURS_END_TIME"
}
]
}
]
}
}
Updating Labour Profile
Function: labour_profile_update()
Purpose
This function updates an existing labour profile in the system. It is used to modify labour profile details such as display name and description while keeping all existing associations, availability rules, pricing sessions, and linked labours intact.
Parameters
| Parameter name | Type | Required | Description |
|---|---|---|---|
| labour-profiles-uuid | String | Yes | The unique UUID of the labour profile to be updated. |
Use Case
This function is used when an existing labour profile needs to be updated due to changes in role naming, operational requirements, or internal documentation. For example, updating a labour profile’s display name to better reflect its responsibilities or revising the description to align with updated business rules.
def test_labour_profile_update():
SDKConfig.PRINT_REQUEST_DATA = True
SDKConfig.PRINT_RAW_RESPONSE = False
token_file_path = "shared_token.json"
file_token_mgr = FileTokenManager(token_file_path)
exsited_sdk: ExsitedSDK = ExsitedSDK().init_sdk(
request_token_dto=CommonData.get_request_token_dto(),
file_token_mgr=file_token_mgr
)
try:
request_data = LabourProfileUpdateDTO(
labourProfile=LabourProfileRequestDataDTO(
displayName="Updated Profile Display Name",
description="Updated profile description"
)
)
response = exsited_sdk.labour.labour_profile_update(uuid="YOUR_PROFILE_UUID", request_data=request_data)
print(response)
except ABException as ab:
print(ab)
print(ab.get_errors())
print(ab.raw_response)
public function testLabourProfileUpdate($profileUUID)
{
try {
echo "\n=== Testing Update Labour Profile ===\n";
echo "UUID: {$profileUUID}\n";
$params = [
"labour_profile" => [
"name" => "Updated Profile",
"display_name" => "Updated Profile Display",
"description" => "Updated via SDK test on " . date('Y-m-d H:i:s')
]
];
echo "Request Data:\n";
echo '<pre>' . json_encode($params, JSON_PRETTY_PRINT) . '</pre>';
$response = $this->labourProfileService->update($profileUUID, $params);
echo "\nResponse:\n";
echo '<pre>' . json_encode($response, JSON_PRETTY_PRINT) . '</pre>';
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
}
Response
The function returns the updated labour profile object. The response includes the labour profile’s status, UUID, name, display name, booking limits, tax and currency configuration, audit information, linked labours, and detailed session data such as pricing, availability schedules, and working hours. This confirms that the labour profile has been successfully updated.
{
"labour_profile": {
"status": "LABOUR_PROFILE_STATUS",
"uuid": "LABOUR_PROFILE_UUID",
"name": "LABOUR_PROFILE_NAME",
"display_name": "LABOUR_PROFILE_DISPLAY_NAME",
"max_booking_limit": "LABOUR_PROFILE_MAX_BOOKING_LIMIT",
"tax_inclusive": "LABOUR_PROFILE_TAX_INCLUSIVE",
"currency": "LABOUR_PROFILE_CURRENCY",
"tax": {
"uuid": "TAX_UUID",
"code": "TAX_CODE",
"rate": "TAX_RATE",
"link": "TAX_LINK"
},
"created_by": "LABOUR_PROFILE_CREATED_BY",
"created_on": "LABOUR_PROFILE_CREATED_ON",
"last_updated_by": "LABOUR_PROFILE_LAST_UPDATED_BY",
"last_updated_on": "LABOUR_PROFILE_LAST_UPDATED_ON",
"labours": [
{
"status": "LABOUR_STATUS",
"uuid": "LABOUR_UUID",
"name": "LABOUR_NAME",
"display_name": "LABOUR_DISPLAY_NAME",
"image_name": "LABOUR_IMAGE_NAME",
"use_custom_availability": "LABOUR_USE_CUSTOM_AVAILABILITY",
"link": "LABOUR_LINK"
}
],
"labour_profile_sessions": [
{
"status": "SESSION_STATUS",
"uuid": "SESSION_UUID",
"name": "SESSION_NAME",
"start_date": "SESSION_START_DATE",
"end_date": "SESSION_END_DATE",
"labour_profile_session_prices": [
{
"id": "SESSION_PRICE_ID",
"status": "SESSION_PRICE_STATUS",
"uuid": "SESSION_PRICE_UUID",
"price": "SESSION_PRICE",
"enabled_pro_rata": "SESSION_ENABLED_PRO_RATA",
"price_type": "SESSION_PRICE_TYPE",
"pricing_level": "SESSION_PRICING_LEVEL",
"labour_profile_session_price_hours": [
{
"status": "PRICE_HOUR_STATUS",
"uuid": "PRICE_HOUR_UUID",
"start_time": "PRICE_HOUR_START_TIME",
"end_time": "PRICE_HOUR_END_TIME",
"price": "PRICE_HOUR_PRICE"
}
]
}
],
"labour_profile_session_availability": [
{
"status": "AVAILABILITY_STATUS",
"uuid": "AVAILABILITY_UUID",
"start_time": "AVAILABILITY_START_TIME",
"end_time": "AVAILABILITY_END_TIME",
"available": "AVAILABILITY_AVAILABLE",
"preferred_day": "AVAILABILITY_PREFERRED_DAY"
}
],
"labour_profile_session_working_hours": [
{
"status": "WORKING_HOURS_STATUS",
"uuid": "WORKING_HOURS_UUID",
"start_time": "WORKING_HOURS_START_TIME",
"end_time": "WORKING_HOURS_END_TIME"
}
]
}
]
}
}
{
"labour_profile": {
"status": "LABOUR_PROFILE_STATUS",
"uuid": "LABOUR_PROFILE_UUID",
"name": "LABOUR_PROFILE_NAME",
"display_name": "LABOUR_PROFILE_DISPLAY_NAME",
"max_booking_limit": "LABOUR_PROFILE_MAX_BOOKING_LIMIT",
"tax_inclusive": "LABOUR_PROFILE_TAX_INCLUSIVE",
"currency": "LABOUR_PROFILE_CURRENCY",
"tax": {
"uuid": "TAX_UUID",
"code": "TAX_CODE",
"rate": "TAX_RATE",
"link": "TAX_LINK"
},
"created_by": "LABOUR_PROFILE_CREATED_BY",
"created_on": "LABOUR_PROFILE_CREATED_ON",
"last_updated_by": "LABOUR_PROFILE_LAST_UPDATED_BY",
"last_updated_on": "LABOUR_PROFILE_LAST_UPDATED_ON",
"labours": [
{
"status": "LABOUR_STATUS",
"uuid": "LABOUR_UUID",
"name": "LABOUR_NAME",
"display_name": "LABOUR_DISPLAY_NAME",
"image_name": "LABOUR_IMAGE_NAME",
"use_custom_availability": "LABOUR_USE_CUSTOM_AVAILABILITY",
"link": "LABOUR_LINK"
}
],
"labour_profile_sessions": [
{
"status": "SESSION_STATUS",
"uuid": "SESSION_UUID",
"name": "SESSION_NAME",
"start_date": "SESSION_START_DATE",
"end_date": "SESSION_END_DATE",
"labour_profile_session_prices": [
{
"id": "SESSION_PRICE_ID",
"status": "SESSION_PRICE_STATUS",
"uuid": "SESSION_PRICE_UUID",
"price": "SESSION_PRICE",
"enabled_pro_rata": "SESSION_ENABLED_PRO_RATA",
"price_type": "SESSION_PRICE_TYPE",
"pricing_level": "SESSION_PRICING_LEVEL",
"labour_profile_session_price_hours": [
{
"status": "PRICE_HOUR_STATUS",
"uuid": "PRICE_HOUR_UUID",
"start_time": "PRICE_HOUR_START_TIME",
"end_time": "PRICE_HOUR_END_TIME",
"price": "PRICE_HOUR_PRICE"
}
]
}
],
"labour_profile_session_availability": [
{
"status": "AVAILABILITY_STATUS",
"uuid": "AVAILABILITY_UUID",
"start_time": "AVAILABILITY_START_TIME",
"end_time": "AVAILABILITY_END_TIME",
"available": "AVAILABILITY_AVAILABLE",
"preferred_day": "AVAILABILITY_PREFERRED_DAY"
}
],
"labour_profile_session_working_hours": [
{
"status": "WORKING_HOURS_STATUS",
"uuid": "WORKING_HOURS_UUID",
"start_time": "WORKING_HOURS_START_TIME",
"end_time": "WORKING_HOURS_END_TIME"
}
]
}
]
}
}
Deleting Labour Profile
Function: labour_profile_delete()
Purpose
This function deletes an existing labour profile from the system. Once deleted, the labour profile can no longer be assigned to labours, used for scheduling, pricing, or availability configurations.
Parameters
| Parameter name | Type | Required | Description |
|---|---|---|---|
| labour-profiles-uuid | String | Yes | The unique UUID of the labour profile to be deleted. |
Use Case
This function is used when a labour profile is no longer required, such as when a role is deprecated, replaced with a new profile, or created in error. It helps keep the system clean and ensures outdated labour profiles do not appear in operational workflows.
def test_labour_profile_delete():
SDKConfig.PRINT_REQUEST_DATA = True
SDKConfig.PRINT_RAW_RESPONSE = False
token_file_path = "shared_token.json"
file_token_mgr = FileTokenManager(token_file_path)
exsited_sdk: ExsitedSDK = ExsitedSDK().init_sdk(
request_token_dto=CommonData.get_request_token_dto(),
file_token_mgr=file_token_mgr
)
try:
response = exsited_sdk.labour.labour_profile_delete(uuid="YOUR_PROFILE_UUID")
print(response)
except ABException as ab:
print(ab)
print(ab.get_errors())
print(ab.raw_response)
public function testLabourProfileDelete($profileUUID)
{
try {
echo "\n=== Testing Delete Labour Profile ===\n";
echo "UUID: {$profileUUID}\n";
$response = $this->labourProfileService->delete($profileUUID);
echo "\nResponse:\n";
echo '<pre>' . json_encode($response, JSON_PRETTY_PRINT) . '</pre>';
$responseArray = is_object($response) ? (array)$response : $response;
if (empty($responseArray) || (isset($responseArray['status']) && $responseArray['status'] == 204)) {
echo "\n✓ Labour profile deleted successfully (204 No Content)\n";
}
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
}
Response
The function returns a success response with an HTTP status code 204 (No Content), indicating that the labour profile has been successfully deleted from the system.
{'SUCCESS': TRUE, 'STATUS_CODE': 204}
null
Getting Available Labours for Booking
Function: labour_available_for_booking()
Purpose
This function retrieves a list of labours that are available for booking within a specified date range. The availability is evaluated based on labour profiles, availability schedules, and existing constraints to ensure only eligible labours are returned.
Parameters
| Parameter | Type | Description |
|---|---|---|
| start_date | String | Start date and time for the booking window in YYYY-MM-DD HH:MM format. |
| end_date | String | End date and time for the booking window in YYYY-MM-DD HH:MM format. |
| profile | String | UUID of the labour profile used to filter available labours by role or skill set. |
Use Case
This function is commonly used during scheduling and booking workflows to identify which labours can be assigned to jobs, timesheets, or service orders within a given time period. It helps planners avoid conflicts, respect availability rules, and efficiently allocate resources.
def test_labour_available_for_booking():
SDKConfig.PRINT_REQUEST_DATA = True
SDKConfig.PRINT_RAW_RESPONSE = False
token_file_path = "shared_token.json"
file_token_mgr = FileTokenManager(token_file_path)
exsited_sdk: ExsitedSDK = ExsitedSDK().init_sdk(
request_token_dto=CommonData.get_request_token_dto(),
file_token_mgr=file_token_mgr
)
try:
param_filters = {
"start_date": "2025-12-13 17:00",
"end_date": "2025-12-19 18:00",
"profile": "PROFILE_UUID"
}
response = exsited_sdk.labour.labour_available_for_booking(param_filters=param_filters)
print(response)
except ABException as ab:
print(ab)
print(ab.get_errors())
print(ab.raw_response)
public function testLabourAvailableForBooking($queryParams = null)
{
try {
echo "\n=== Testing Get Available Labours for Booking ===\n";
if ($queryParams) {
echo "Query Parameters:\n";
echo '<pre>' . json_encode($queryParams, JSON_PRETTY_PRINT) . '</pre>';
}
$response = $this->labourService->availableForBooking($queryParams);
echo "\nResponse:\n";
echo '<pre>' . json_encode($response, JSON_PRETTY_PRINT) . '</pre>';
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
}
Response
The function returns an object containing a list of available labours. Each labour entry includes status, UUID, labour code, name, display name, email address, labour profile details, availability information, audit fields, and related metadata. The response may also include a count of available labours matching the criteria.
AvailableLabourListDTO(
labours=[
AvailableLabourDTO(
status='LABOUR_STATUS',
uuid='LABOUR_UUID',
code='LABOUR_CODE',
name='LABOUR_NAME',
displayName='LABOUR_DISPLAY_NAME',
description='LABOUR_DESCRIPTION',
imageName='LABOUR_IMAGE_NAME',
emailAddress='LABOUR_EMAIL_ADDRESS',
useCustomAvailability=LABOUR_USE_CUSTOM_AVAILABILITY,
labourProfile=LabourProfileDTO(
status='LABOUR_PROFILE_STATUS',
uuid='LABOUR_PROFILE_UUID',
name='LABOUR_PROFILE_NAME',
displayName='LABOUR_PROFILE_DISPLAY_NAME',
link='LABOUR_PROFILE_LINK'
),
customFormTemplate='LABOUR_CUSTOM_FORM_TEMPLATE',
availableSlots=AVAILABLE_SLOTS,
createdBy='LABOUR_CREATED_BY',
createdOn='LABOUR_CREATED_ON',
lastUpdatedBy='LABOUR_LAST_UPDATED_BY',
lastUpdatedOn='LABOUR_LAST_UPDATED_ON'
)
],
availableCount=AVAILABLE_COUNT
)
{
"labours": [
{
"status": "LABOUR_STATUS",
"uuid": "LABOUR_UUID",
"code": "LABOUR_CODE",
"name": "LABOUR_NAME",
"display_name": "LABOUR_DISPLAY_NAME",
"description": "LABOUR_DESCRIPTION",
"image_name": "LABOUR_IMAGE_NAME",
"email_address": "LABOUR_EMAIL_ADDRESS",
"use_custom_availability": LABOUR_USE_CUSTOM_AVAILABILITY,
"labour_profile": {
"status": "LABOUR_PROFILE_STATUS",
"uuid": "LABOUR_PROFILE_UUID",
"name": "LABOUR_PROFILE_NAME",
"display_name": "LABOUR_PROFILE_DISPLAY_NAME",
"link": "LABOUR_PROFILE_LINK"
},
"custom_form_template": "LABOUR_CUSTOM_FORM_TEMPLATE",
"created_by": "LABOUR_CREATED_BY",
"created_on": "LABOUR_CREATED_ON",
"last_updated_by": "LABOUR_LAST_UPDATED_BY",
"last_updated_on": "LABOUR_LAST_UPDATED_ON",
"custom_attributes": [],
"labour_custom_availability": "LABOUR_CUSTOM_AVAILABILITY",
"labour_availability": []
}
]
}