» Labour Module SDK Documentation

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

ParameterTypeDescription
limitIntegerNumber of labour records to retrieve per page.
offsetIntegerNumber of records to skip from the beginning of the result set.
recordsIntegerTotal number of records returned in the current response.
previous_pageStringURL for the previous page of results, if available.
next_pageStringURL 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)

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
      )
    ]
  )
])

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

ParameterTypeDescription
labour-idStringUnique 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)

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
      )
    ]
  )
)

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)

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
  )
)

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 nameTypeRequiredDescription
labours-uuidStringYesThe 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)

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
      )
    ]
  )
)

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 nameTypeRequiredDescription
labours-uuidStringYesThe 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)

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}

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

ParameterTypeDescription
limitIntegerNumber of labour profile records to retrieve per page.
offsetIntegerNumber of records to skip from the beginning of the result set.
recordsIntegerTotal number of records returned in the current response.
previous_pageStringURL for the previous page of results, if available.
next_pageStringURL 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)

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'
    )
  ]
)

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

ParameterTypeRequiredDescription
profile-uuidStringYesThe 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)

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'
  )
)

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)

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"
          }
        ]
      }
    ]
  }
}

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 nameTypeRequiredDescription
labour-profiles-uuidStringYesThe 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)

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"
          }
        ]
      }
    ]
  }
}

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 nameTypeRequiredDescription
labour-profiles-uuidStringYesThe 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)

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}

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

ParameterTypeDescription
start_dateStringStart date and time for the booking window in YYYY-MM-DD HH:MM format.
end_dateStringEnd date and time for the booking window in YYYY-MM-DD HH:MM format.
profileStringUUID 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)

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
)

Looking to build next big project?

With our robust set of tools and resources, you can create custom solutions that integrate seamlessly with our system and take your business to the next level.

Join Our Partner Program