7 / 8
Mar 31

Hi everyone,
I am having a problem with creating a parent Infolog and child Infologs.

  • I have attached an email to a group to create with Infolog but there is a problem that it does not work with the group email.

  • When I create the parent Infolog, it has a UID but creating subs by UID is completely impossible to attach.
     def create_task_on_egroupware(request, title, egroupware_group_id, description, parent_uid=None):

        API_URL = settings.EGROUPWARE_API_URL
        username = request.user.username
        password = settings.EGROUPWARE_CREDENTIALS.get('password')

        api_url = f"{API_URL}/{username}/infolog/"

        headers = {
            "Content-Type": "application/json",
            "Prefer": "return=representation",
            "Accept": "application/pretty+json"
        }

        # šŸ”¹ Lįŗ„y thį»i gian hiį»‡n tįŗ”i theo chuįŗ©n UTC, đį»‹nh dįŗ”ng ISO 8601
        start_time = datetime.now(timezone.utc).isoformat()

        # šŸ”¹ Lįŗ„y thĆ“ng tin nhĆ³m tį»« ExtendedGroup dį»±a vĆ o egroupware_group_id
        try:
            group = ExtendedGroup.objects.get(egroupware_group_id=egroupware_group_id)
            group_name = group.group.name  # Lįŗ„y tĆŖn group
            group_email = group.email_manager  # Lįŗ„y email manager
            group_principal_url = f"principals/groups/{group_name.lower()}/"  # DĆ¹ng principal-URL
        except ExtendedGroup.DoesNotExist:
            print(f"āŒ Group not found for egroupware_group_id = {egroupware_group_id}")
            return None

        # šŸ”¹ Đį»‹nh nghÄ©a payload
        payload = {
            "title": title,
            "start": start_time,  # Thį»i gian tįŗ”o task
            "timeZone": "Europe/Warsaw",  # MĆŗi giį»
            "description": description,  # MĆ“ tįŗ£ task
            "priority": 5,  # Đį»™ Ę°u tiĆŖn mįŗ·c đį»‹nh
            "participants": [
                {
                    "@type": "Participant",
                    "name": group_name,
                    "uri": group_principal_url,  # šŸŸ¢ DĆ¹ng principal-URL thay vƬ email
                    "email": group_email,
                    "kind": "group",
                    "roles": {"attendee": True}
                }
            ],
            "status": "confirmed",
            "progress": "needs-action",
        }

        # Nįŗæu cĆ³ nhiį»‡m vį»„ cha, thĆŖm `relatedTo` đĆŗng đį»‹nh dįŗ”ng
        if parent_uid:
            payload["relatedTo"] = {
                parent_uid: {
                    "@type": "Relation",
                    "relation": "parent"
                }
            }

        print(f"šŸ”¹ Sending request to EGroupware: {json.dumps(payload, indent=2)}")

        # šŸ”¹ Gį»­i request lĆŖn EGroupware
        response = requests.post(api_url, auth=(username, password), headers=headers, json=payload)

        print(f"šŸ”¹ Response status: {response.status_code}")
        print(f"šŸ”¹ Response text: {response.text}")

        # šŸ”¹ Xį»­ lĆ½ lį»—i JSONDecodeError nįŗæu phįŗ£n hį»“i rį»—ng
        if response.status_code == 201:
            try:
                result = response.json()
                return result.get("uid", None)  # Trįŗ£ vį» UID cį»§a task vį»«a tįŗ”o
            except json.JSONDecodeError:
                print(f"āš ļø JSONDecodeError but task created successfully.")
                return "Task Created (No JSON Response)"  # Giįŗ£ lįŗ­p UID

        else:
            print(f"āš ļø Error creating task: {response.text}")
            return None

     def wait_for_task_creation(api_url, auth, task_uid, headers, max_retries=10, wait_time=5):

        for i in range(max_retries):
            print(f"ā³ Check if parent task exists... Attempt {i+1}/{max_retries}")

            response = requests.get(api_url, auth=auth, headers=headers)

            if response.status_code == 200:
                try:
                    tasks = response.json().get("responses", {})

                    # Kiį»ƒm tra nįŗæu task cha Ä‘Ć£ xuįŗ„t hiį»‡n
                    for task_url, task in tasks.items():
                        if task.get("uid") == task_uid:
                            print(f"āœ… Task parent {task_uid} exists in EGroupware!")
                            return True  

                    # šŸ”¹ Nįŗæu chĘ°a tƬm thįŗ„y, thį»­ tƬm theo title
                    print("āš ļø Task parent {task_uid} not found, searching by title...")
                    title_search_url = f"{api_url}?filter[title]=Room 101"
                    search_response = requests.get(title_search_url, auth=auth, headers=headers)
                    
                    if search_response.status_code == 200:
                        task_data = search_response.json().get("responses", {})
                        for task_url, task in task_data.items():
                            if task.get("title") == f"Room {room_number}":
                                found_uid = task.get("uid")
                                print(f"āœ… Task parent {found_uid} exists in EGroupware!")
                                return found_uid  # Trįŗ£ vį» UID mį»›i

                except json.JSONDecodeError:
                    print("āš ļø JSONDecodeError - Response is not valid JSON. Try again...")

            time.sleep(wait_time)

        print(f"āŒ Task parent {task_uid} does not exist after {max_retries} retries!")
        return False

     def create_checkout_room_task(request, room_number):

        extended_group = get_object_or_404(ExtendedGroup, group__name="housekeeping")
        egroupware_group_id = extended_group.egroupware_group_id

        # Tįŗ”o Task cha
        parent_uid = create_task_on_egroupware(
            request,
            title=f"Room {room_number}",
            egroupware_group_id=egroupware_group_id,
            description=f"Room {room_number}"
        )

        if not parent_uid:
            return "āŒ Error creating Task Room on EGroupware!"

        # Chį» task cha xuįŗ„t hiį»‡n trĘ°į»›c khi tįŗ”o sub-task
        API_URL = settings.EGROUPWARE_API_URL
        username = request.user.username
        password = settings.EGROUPWARE_CREDENTIALS.get('password')
        headers = {"Accept": "application/pretty+json"}

        if not wait_for_task_creation(f"{API_URL}/{username}/infolog/", auth=(username, password), task_uid=parent_uid, headers=headers):
            print(f"āš ļø The parent task {parent_uid} does not exist. Try retrieving the task list from the EGroupware API...")

            response = requests.get(f"{API_URL}/{username}/infolog/?filter[title]=Room {room_number}", auth=(username, password), headers=headers)
            if response.status_code == 200:
                try:
                    task_data = response.json().get("responses", {})
                    for task_url, task in task_data.items():
                        if task.get("title") == f"Room {room_number}":
                            parent_uid = task.get("uid")
                            print(f"āœ… Found parent task again: {parent_uid}")
                            break
                except json.JSONDecodeError:
                    print(f"āŒ JSONDecodeError - Response is not valid JSON. Try again...")

        if not parent_uid:
            return f"āŒ The parent task {parent_uid} has not yet been recorded in the system.!"

        # Lįŗ„y danh sĆ”ch sub-task tį»« TaskTemplate
        sub_tasks = TaskTemplate.objects.filter(task_type="Cleaning vacant rooms")

        for task in sub_tasks:
            subtask_description = f"""
            Task Parent: Room {room_number}
            Area: {task.area}
            Task: {task.name}
            """

            create_task_on_egroupware(
                request,
                title=f"Room {room_number}: {task.name}",
                egroupware_group_id=egroupware_group_id,
                description=subtask_description.strip(),
                parent_uid=parent_uid
            )

        return f"āœ… Task Room {room_number} and sub-tasks have been created on EGroupware!"

:small_blue_diamond: Sending request to EGroupware: {
ā€œtitleā€: ā€œRoom 101ā€,
ā€œstartā€: ā€œ2025-03-05T12:05:22.232169+00:00ā€,
ā€œtimeZoneā€: ā€œEurope/Warsawā€,
ā€œdescriptionā€: ā€œRoom 101ā€,
ā€œpriorityā€: 5,
ā€œparticipantsā€: [
{
"@type": ā€œParticipantā€,
ā€œnameā€: ā€œhousekeepingā€,
ā€œuriā€: ā€œprincipals/groups/housekeeping/ā€,
ā€œemailā€: "-1008@lists.egroupware.org",
ā€œkindā€: ā€œgroupā€,
ā€œrolesā€: {
ā€œattendeeā€: true
}
}
],
ā€œstatusā€: ā€œconfirmedā€,
ā€œprogressā€: ā€œneeds-actionā€
}
:small_blue_diamond: Response status: 201
:small_blue_diamond: Response text: {
"@type": ā€œTaskā€,
ā€œprodIdā€: ā€œEGroupware InfoLog 23.1.011ā€,
ā€œuidā€: ā€œurn:uuid:f8e4616e-22b3-43f2-8d82-30c69ff10ca5ā€,
ā€œcreatedā€: ā€œ2025-03-05T12:05:22Zā€,
ā€œtitleā€: ā€œRoom 101ā€,
ā€œstartā€: ā€œ2025-03-05T13:05:22ā€,
ā€œtimeZoneā€: ā€œEurope/Warsawā€,
ā€œdescriptionā€: ā€œRoom 101ā€,
ā€œparticipantsā€: {
ā€œ1067ā€: {
"@type": ā€œParticipantā€,
ā€œnameā€: ā€œTuan Nguyen Leā€,
ā€œemailā€: "ngletuan94@gmail.com",
ā€œkindā€: ā€œindividualā€,
ā€œrolesā€: { ā€œownerā€: true }
},
ā€œhousekeeping -1008@lists.egroupware.orgā€: {
"@type": ā€œParticipantā€,
ā€œnameā€: ā€œhousekeepingā€,
ā€œemailā€: "-1008@lists.egroupware.org",
ā€œkindā€: ā€œindividualā€,
ā€œrolesā€: { ā€œinformationalā€: true }
}
},
ā€œstatusā€: ā€œconfirmedā€,
ā€œprogressā€: ā€œneeds-actionā€,
ā€œpriorityā€: 9,
ā€œprivacyā€: ā€œpublicā€,
ā€œegroupware.org:typeā€: ā€œtaskā€
}
:hourglass_flowing_sand: Check if parent task existsā€¦ Attempt 1/10
:white_check_mark: Task parent urn:uuid:f8e4616e-22b3-43f2-8d82-30c69ff10ca5 exists in EGroupware!
:small_blue_diamond: Sending request to EGroupware: {
ā€œtitleā€: ā€œRoom 101: Change bed linens and sheetsā€,
ā€œstartā€: ā€œ2025-03-05T12:05:22.470393+00:00ā€,
ā€œtimeZoneā€: ā€œEurope/Warsawā€,
ā€œdescriptionā€: ā€œTask Parent: Room 101\n Area: Hotel\n Task: Change bed linens and sheetsā€,
ā€œpriorityā€: 5,
ā€œparticipantsā€: [
{
"@type": ā€œParticipantā€,
ā€œnameā€: ā€œhousekeepingā€,
ā€œuriā€: ā€œprincipals/groups/housekeeping/ā€,
ā€œemailā€: "-1008@lists.egroupware.org",
ā€œkindā€: ā€œgroupā€,
ā€œrolesā€: {
ā€œattendeeā€: true
}
}
],
ā€œstatusā€: ā€œconfirmedā€,
ā€œprogressā€: ā€œneeds-actionā€,
ā€œrelatedToā€: {
ā€œurn:uuid:f8e4616e-22b3-43f2-8d82-30c69ff10ca5ā€: {
"@type": ā€œRelationā€,
ā€œrelationā€: ā€œparentā€
}
}
}
:small_blue_diamond: Response status: 422
:small_blue_diamond: Response text: {
ā€œerrorā€: 422,
ā€œmessageā€: ā€œError parsing JsTask attribute ā€˜relatedToā€™: UID ā€˜urn:uuid:f8e4616e-22b3-43f2-8d82-30c69ff10ca5ā€™ NOT found!ā€
}
:warning:ļø Error creating task: {
ā€œerrorā€: 422,
ā€œmessageā€: ā€œError parsing JsTask attribute ā€˜relatedToā€™: UID ā€˜urn:uuid:f8e4616e-22b3-43f2-8d82-30c69ff10ca5ā€™ NOT found!ā€
}
:small_blue_diamond: Sending request to EGroupware: {
ā€œtitleā€: ā€œRoom 101: Vacuum the entire room and bathroomā€,
ā€œstartā€: ā€œ2025-03-05T12:05:22.541383+00:00ā€,
ā€œtimeZoneā€: ā€œEurope/Warsawā€,
ā€œdescriptionā€: ā€œTask Parent: Room 101\n Area: Hotel\n Task: Vacuum the entire room and bathroomā€,
ā€œpriorityā€: 5,
ā€œparticipantsā€: [
{
"@type": ā€œParticipantā€,
ā€œnameā€: ā€œhousekeepingā€,
ā€œuriā€: ā€œprincipals/groups/housekeeping/ā€,
ā€œemailā€: "-1008@lists.egroupware.org",
ā€œkindā€: ā€œgroupā€,
ā€œrolesā€: {
ā€œattendeeā€: true
}
}
],
ā€œstatusā€: ā€œconfirmedā€,
ā€œprogressā€: ā€œneeds-actionā€,
ā€œrelatedToā€: {
ā€œurn:uuid:f8e4616e-22b3-43f2-8d82-30c69ff10ca5ā€: {
"@type": ā€œRelationā€,
ā€œrelationā€: ā€œparentā€
}
}
}
:small_blue_diamond: Response status: 422
:small_blue_diamond: Response text: {
ā€œerrorā€: 422,
ā€œmessageā€: ā€œError parsing JsTask attribute ā€˜relatedToā€™: UID ā€˜urn:uuid:f8e4616e-22b3-43f2-8d82-30c69ff10ca5ā€™ NOT found!ā€
}
:warning:ļø Error creating task: {
ā€œerrorā€: 422,
ā€œmessageā€: ā€œError parsing JsTask attribute ā€˜relatedToā€™: UID ā€˜urn:uuid:f8e4616e-22b3-43f2-8d82-30c69ff10ca5ā€™ NOT found!ā€
}
:small_blue_diamond: Sending request to EGroupware: {
ā€œtitleā€: ā€œRoom 101: Dust the desk, wardrobe, doors, windowsills, lampsā€,
ā€œstartā€: ā€œ2025-03-05T12:05:22.610553+00:00ā€,
ā€œtimeZoneā€: ā€œEurope/Warsawā€,
ā€œdescriptionā€: ā€œTask Parent: Room 101\n Area: Hotel\n Task: Dust the desk, wardrobe, doors, windowsills, lampsā€,
ā€œpriorityā€: 5,
ā€œparticipantsā€: [
{
"@type": ā€œParticipantā€,
ā€œnameā€: ā€œhousekeepingā€,
ā€œuriā€: ā€œprincipals/groups/housekeeping/ā€,
ā€œemailā€: "-1008@lists.egroupware.org",
ā€œkindā€: ā€œgroupā€,
ā€œrolesā€: {
ā€œattendeeā€: true
}
}
],
ā€œstatusā€: ā€œconfirmedā€,
ā€œprogressā€: ā€œneeds-actionā€,
ā€œrelatedToā€: {
ā€œurn:uuid:f8e4616e-22b3-43f2-8d82-30c69ff10ca5ā€: {
"@type": ā€œRelationā€,
ā€œrelationā€: ā€œparentā€
}
}
}
:small_blue_diamond: Response status: 422
:small_blue_diamond: Response text: {
ā€œerrorā€: 422,
ā€œmessageā€: ā€œError parsing JsTask attribute ā€˜relatedToā€™: UID ā€˜urn:uuid:f8e4616e-22b3-43f2-8d82-30c69ff10ca5ā€™ NOT found!ā€
}
:warning:ļø Error creating task: {
ā€œerrorā€: 422,
ā€œmessageā€: ā€œError parsing JsTask attribute ā€˜relatedToā€™: UID ā€˜urn:uuid:f8e4616e-22b3-43f2-8d82-30c69ff10ca5ā€™ NOT found!ā€
}
:small_blue_diamond: Sending request to EGroupware: {
ā€œtitleā€: ā€œRoom 101: Clean the kettle and cupsā€,
ā€œstartā€: ā€œ2025-03-05T12:05:22.682884+00:00ā€,
ā€œtimeZoneā€: ā€œEurope/Warsawā€,
ā€œdescriptionā€: ā€œTask Parent: Room 101\n Area: Hotel\n Task: Clean the kettle and cupsā€,
ā€œpriorityā€: 5,
ā€œparticipantsā€: [
{
"@type": ā€œParticipantā€,
ā€œnameā€: ā€œhousekeepingā€,
ā€œuriā€: ā€œprincipals/groups/housekeeping/ā€,
ā€œemailā€: "-1008@lists.egroupware.org",
ā€œkindā€: ā€œgroupā€,
ā€œrolesā€: {
ā€œattendeeā€: true
}
}
],
ā€œstatusā€: ā€œconfirmedā€,
ā€œprogressā€: ā€œneeds-actionā€,
ā€œrelatedToā€: {
ā€œurn:uuid:f8e4616e-22b3-43f2-8d82-30c69ff10ca5ā€: {
"@type": ā€œRelationā€,
ā€œrelationā€: ā€œparentā€
}
}
}
:small_blue_diamond: Response status: 422
:small_blue_diamond: Response text: {
ā€œerrorā€: 422,
ā€œmessageā€: ā€œError parsing JsTask attribute ā€˜relatedToā€™: UID ā€˜urn:uuid:f8e4616e-22b3-43f2-8d82-30c69ff10ca5ā€™ NOT found!ā€
}
:warning:ļø Error creating task: {
ā€œerrorā€: 422,
ā€œmessageā€: ā€œError parsing JsTask attribute ā€˜relatedToā€™: UID ā€˜urn:uuid:f8e4616e-22b3-43f2-8d82-30c69ff10ca5ā€™ NOT found!ā€
}
:small_blue_diamond: Sending request to EGroupware: {
ā€œtitleā€: ā€œRoom 101: Refill the coffee and tea set, leave a bottle of waterā€,
ā€œstartā€: ā€œ2025-03-05T12:05:22.759663+00:00ā€,
ā€œtimeZoneā€: ā€œEurope/Warsawā€,
ā€œdescriptionā€: ā€œTask Parent: Room 101\n Area: Hotel\n Task: Refill the coffee and tea set, leave a bottle of waterā€,
ā€œpriorityā€: 5,
ā€œparticipantsā€: [
{
"@type": ā€œParticipantā€,
ā€œnameā€: ā€œhousekeepingā€,
ā€œuriā€: ā€œprincipals/groups/housekeeping/ā€,
ā€œemailā€: "-1008@lists.egroupware.org",
ā€œkindā€: ā€œgroupā€,
ā€œrolesā€: {
ā€œattendeeā€: true
}
}
],
ā€œstatusā€: ā€œconfirmedā€,
ā€œprogressā€: ā€œneeds-actionā€,
ā€œrelatedToā€: {
ā€œurn:uuid:f8e4616e-22b3-43f2-8d82-30c69ff10ca5ā€: {
"@type": ā€œRelationā€,
ā€œrelationā€: ā€œparentā€
}
}
}
:small_blue_diamond: Response status: 422
:small_blue_diamond: Response text: {
ā€œerrorā€: 422,
ā€œmessageā€: ā€œError parsing JsTask attribute ā€˜relatedToā€™: UID ā€˜urn:uuid:f8e4616e-22b3-43f2-8d82-30c69ff10ca5ā€™ NOT found!ā€
}
:warning:ļø Error creating task: {
ā€œerrorā€: 422,
ā€œmessageā€: ā€œError parsing JsTask attribute ā€˜relatedToā€™: UID ā€˜urn:uuid:f8e4616e-22b3-43f2-8d82-30c69ff10ca5ā€™ NOT found!ā€
}
:small_blue_diamond: Sending request to EGroupware: {
ā€œtitleā€: ā€œRoom 101: Check the hotel service brochure set, restock if necessaryā€,
ā€œstartā€: ā€œ2025-03-05T12:05:22.828724+00:00ā€,
ā€œtimeZoneā€: ā€œEurope/Warsawā€,
ā€œdescriptionā€: ā€œTask Parent: Room 101\n Area: Hotel\n Task: Check the hotel service brochure set, restock if necessaryā€,
ā€œpriorityā€: 5,
ā€œparticipantsā€: [
{
"@type": ā€œParticipantā€,
ā€œnameā€: ā€œhousekeepingā€,
ā€œuriā€: ā€œprincipals/groups/housekeeping/ā€,
ā€œemailā€: "-1008@lists.egroupware.org",
ā€œkindā€: ā€œgroupā€,
ā€œrolesā€: {
ā€œattendeeā€: true
}
}
],
ā€œstatusā€: ā€œconfirmedā€,
ā€œprogressā€: ā€œneeds-actionā€,
ā€œrelatedToā€: {
ā€œurn:uuid:f8e4616e-22b3-43f2-8d82-30c69ff10ca5ā€: {
"@type": ā€œRelationā€,
ā€œrelationā€: ā€œparentā€
}
}
}
:small_blue_diamond: Response status: 422
:small_blue_diamond: Response text: {
ā€œerrorā€: 422,
ā€œmessageā€: ā€œError parsing JsTask attribute ā€˜relatedToā€™: UID ā€˜urn:uuid:f8e4616e-22b3-43f2-8d82-30c69ff10ca5ā€™ NOT found!ā€
}
:warning:ļø Error creating task: {
ā€œerrorā€: 422,
ā€œmessageā€: ā€œError parsing JsTask attribute ā€˜relatedToā€™: UID ā€˜urn:uuid:f8e4616e-22b3-43f2-8d82-30c69ff10ca5ā€™ NOT found!ā€
}
:small_blue_diamond: Sending request to EGroupware: {
ā€œtitleā€: ā€œRoom 101: Clean the ceiling and remove cobwebsā€,
ā€œstartā€: ā€œ2025-03-05T12:05:22.893179+00:00ā€,
ā€œtimeZoneā€: ā€œEurope/Warsawā€,
ā€œdescriptionā€: ā€œTask Parent: Room 101\n Area: Hotel\n Task: Clean the ceiling and remove cobwebsā€,
ā€œpriorityā€: 5,
ā€œparticipantsā€: [
{
"@type": ā€œParticipantā€,
ā€œnameā€: ā€œhousekeepingā€,
ā€œuriā€: ā€œprincipals/groups/housekeeping/ā€,
ā€œemailā€: "-1008@lists.egroupware.org",
ā€œkindā€: ā€œgroupā€,
ā€œrolesā€: {
ā€œattendeeā€: true
}
}
],
ā€œstatusā€: ā€œconfirmedā€,
ā€œprogressā€: ā€œneeds-actionā€,
ā€œrelatedToā€: {
ā€œurn:uuid:f8e4616e-22b3-43f2-8d82-30c69ff10ca5ā€: {
"@type": ā€œRelationā€,
ā€œrelationā€: ā€œparentā€
}
}
}
:small_blue_diamond: Response status: 422
:small_blue_diamond: Response text: {
ā€œerrorā€: 422,
ā€œmessageā€: ā€œError parsing JsTask attribute ā€˜relatedToā€™: UID ā€˜urn:uuid:f8e4616e-22b3-43f2-8d82-30c69ff10ca5ā€™ NOT found!ā€
}
:warning:ļø Error creating task: {
ā€œerrorā€: 422,
ā€œmessageā€: ā€œError parsing JsTask attribute ā€˜relatedToā€™: UID ā€˜urn:uuid:f8e4616e-22b3-43f2-8d82-30c69ff10ca5ā€™ NOT found!ā€
}
:small_blue_diamond: Sending request to EGroupware: {
ā€œtitleā€: ā€œRoom 101: Clean the fridge, discard any leftover productsā€,
ā€œstartā€: ā€œ2025-03-05T12:05:22.969534+00:00ā€,
ā€œtimeZoneā€: ā€œEurope/Warsawā€,
ā€œdescriptionā€: ā€œTask Parent: Room 101\n Area: Hotel\n Task: Clean the fridge, discard any leftover productsā€,
ā€œpriorityā€: 5,
ā€œparticipantsā€: [
{
"@type": ā€œParticipantā€,
ā€œnameā€: ā€œhousekeepingā€,
ā€œuriā€: ā€œprincipals/groups/housekeeping/ā€,
ā€œemailā€: "-1008@lists.egroupware.org",
ā€œkindā€: ā€œgroupā€,
ā€œrolesā€: {
ā€œattendeeā€: true
}
}
],
ā€œstatusā€: ā€œconfirmedā€,
ā€œprogressā€: ā€œneeds-actionā€,
ā€œrelatedToā€: {
ā€œurn:uuid:f8e4616e-22b3-43f2-8d82-30c69ff10ca5ā€: {
"@type": ā€œRelationā€,
ā€œrelationā€: ā€œparentā€
}
}
}
:small_blue_diamond: Response status: 422
:small_blue_diamond: Response text: {
ā€œerrorā€: 422,
ā€œmessageā€: ā€œError parsing JsTask attribute ā€˜relatedToā€™: UID ā€˜urn:uuid:f8e4616e-22b3-43f2-8d82-30c69ff10ca5ā€™ NOT found!ā€
}
:warning:ļø Error creating task: {
ā€œerrorā€: 422,
ā€œmessageā€: ā€œError parsing JsTask attribute ā€˜relatedToā€™: UID ā€˜urn:uuid:f8e4616e-22b3-43f2-8d82-30c69ff10ca5ā€™ NOT found!ā€
}
:small_blue_diamond: Sending request to EGroupware: {
ā€œtitleā€: ā€œRoom 101: Clean windows, frames, and windowsills (both sides)ā€,
ā€œstartā€: ā€œ2025-03-05T12:05:23.035995+00:00ā€,
ā€œtimeZoneā€: ā€œEurope/Warsawā€,
ā€œdescriptionā€: ā€œTask Parent: Room 101\n Area: Hotel\n Task: Clean windows, frames, and windowsills (both sides)ā€,
ā€œpriorityā€: 5,
ā€œparticipantsā€: [
{
"@type": ā€œParticipantā€,
ā€œnameā€: ā€œhousekeepingā€,
ā€œuriā€: ā€œprincipals/groups/housekeeping/ā€,
ā€œemailā€: "-1008@lists.egroupware.org",
ā€œkindā€: ā€œgroupā€,
ā€œrolesā€: {
ā€œattendeeā€: true
}
}
],
ā€œstatusā€: ā€œconfirmedā€,
ā€œprogressā€: ā€œneeds-actionā€,
ā€œrelatedToā€: {
ā€œurn:uuid:f8e4616e-22b3-43f2-8d82-30c69ff10ca5ā€: {
"@type": ā€œRelationā€,
ā€œrelationā€: ā€œparentā€
}
}
}
:small_blue_diamond: Response status: 422
:small_blue_diamond: Response text: {
ā€œerrorā€: 422,
ā€œmessageā€: ā€œError parsing JsTask attribute ā€˜relatedToā€™: UID ā€˜urn:uuid:f8e4616e-22b3-43f2-8d82-30c69ff10ca5ā€™ NOT found!ā€
}
:warning:ļø Error creating task: {
ā€œerrorā€: 422,
ā€œmessageā€: ā€œError parsing JsTask attribute ā€˜relatedToā€™: UID ā€˜urn:uuid:f8e4616e-22b3-43f2-8d82-30c69ff10ca5ā€™ NOT found!ā€
}
:small_blue_diamond: Sending request to EGroupware: {
ā€œtitleā€: ā€œRoom 101: Wipe the entrance door to the room and bathroomā€,
ā€œstartā€: ā€œ2025-03-05T12:05:23.114756+00:00ā€,
ā€œtimeZoneā€: ā€œEurope/Warsawā€,
ā€œdescriptionā€: ā€œTask Parent: Room 101\n Area: Hotel\n Task: Wipe the entrance door to the room and bathroomā€,
ā€œpriorityā€: 5,
ā€œparticipantsā€: [
{
"@type": ā€œParticipantā€,
ā€œnameā€: ā€œhousekeepingā€,
ā€œuriā€: ā€œprincipals/groups/housekeeping/ā€,
ā€œemailā€: "-1008@lists.egroupware.org",
ā€œkindā€: ā€œgroupā€,
ā€œrolesā€: {
ā€œattendeeā€: true
}
}
],
ā€œstatusā€: ā€œconfirmedā€,
ā€œprogressā€: ā€œneeds-actionā€,
ā€œrelatedToā€: {
ā€œurn:uuid:f8e4616e-22b3-43f2-8d82-30c69ff10ca5ā€: {
"@type": ā€œRelationā€,
ā€œrelationā€: ā€œparentā€
}
}
}
:small_blue_diamond: Response status: 422
:small_blue_diamond: Response text: {
ā€œerrorā€: 422,
ā€œmessageā€: ā€œError parsing JsTask attribute ā€˜relatedToā€™: UID ā€˜urn:uuid:f8e4616e-22b3-43f2-8d82-30c69ff10ca5ā€™ NOT found!ā€
}
:warning:ļø Error creating task: {
ā€œerrorā€: 422,
ā€œmessageā€: ā€œError parsing JsTask attribute ā€˜relatedToā€™: UID ā€˜urn:uuid:f8e4616e-22b3-43f2-8d82-30c69ff10ca5ā€™ NOT found!ā€
}

  • I have tried all ways to fix the error but still not working.

Hi ngletuan,

Using an email address to identify a group is currently NOT working, I need to fix this :frowning:

This is due to the fact that you prefixed the UID with ā€œurn:uuid:ā€, which is currently not understood, we expects just the UID. I will change the parser to allow an optional prefix of ā€œurn:uuid:ā€.

Ralf

Good morning Sir,

I am building a separate ERP application, and Egroupware is used to manage the main database. So it will be completely API-based so Infolog or Calendar cannot use UID prefixed with ā€œurn:uuid" or add Group was participants

That is not what I said!

I will fix these bugs, but in the meantime you can work around one of them by removing the prefix ā€œurn:uuid:ā€ from the UID.

Ralf

24 days later

I tried to adjust everything but it still shows the same error even though I also updated Egroupware to the new version

[31/Mar/2025 13:50:45] "GET /api/fetch_tasks/?status=&t=1743421844376 HTTP/1.1" 200 5684
šŸ”¹ Sending request to EGroupware: {
  "title": "Room 101",
  "start": "2025-03-31T11:50:48.733782+00:00",
  "timeZone": "Europe/Warsaw",
  "description": "Room 101",
  "priority": 5,
  "participants": [
    {
      "@type": "participant",
      "name": "housekeeping",
      "email": "housekeeping@jesshotel.pl",
      "kind": "group",
      "roles": {
        "attendee": true
      }
    }
  ],
  "status": "confirmed",
  "progress": "needs-action"
}
šŸ”¹ Response status: 201
šŸ”¹ Response text: {
    "@type": "Task",
    "prodId": "EGroupware InfoLog 23.1.011",
    "uid": "urn:uuid:b8a26c8d-d605-45b0-8e15-cbabb8aa105d",
    "created": "2025-03-31T11:50:48Z",
    "title": "Room 101",
    "start": "2025-03-31T13:50:48",
    "timeZone": "Europe/Warsaw",
    "description": "Room 101",
    "participants": {
        "1067": {
            "@type": "Participant",
            "name": "Tuan Nguyen Le",
            "email": "ngletuan94@gmail.com",
            "kind": "individual",
            "roles": { "owner": true }
        },
        "housekeeping <housekeeping@jesshotel.pl>": {
            "@type": "Participant",
            "name": "housekeeping",
            "email": "housekeeping@jesshotel.pl",
            "kind": "individual",
            "roles": { "informational": true }
        }
    },
    "status": "confirmed",
    "progress": "needs-action",
    "priority": 9,
    "privacy": "public",
    "egroupware.org:type": "task"
}
āœ… Parent Task urn:uuid:b8a26c8d-d605-45b0-8e15-cbabb8aa105d confirmed. Proceeding with sub-task creation...
šŸ”¹ Sending request to EGroupware: {
  "title": "Room 101: Change bed linens and sheets",
  "start": "2025-03-31T11:50:53.984042+00:00",
  "timeZone": "Europe/Warsaw",
  "description": "Task Parent: Room 101\n        Area: Hotel\n        Task: Change bed linens and sheets",
  "priority": 5,
  "participants": [
    {
      "@type": "participant",
      "name": "housekeeping",
      "uri": "principals/groups/housekeeping/",
      "email": "housekeeping@jesshotel.pl",
      "kind": "group",
      "roles": {
        "attendee": true
      }
    }
  ],
  "status": "confirmed",
  "progress": "needs-action",
  "relatedTo": {
    "urn:uuid:b8a26c8d-d605-45b0-8e15-cbabb8aa105d": {
      "@type": "Relation",
      "relation": "parent"
    }
  }
}
šŸ”¹ Response status: 422
šŸ”¹ Response text: {
    "error": 422,
    "message": "Error parsing JsTask attribute 'relatedTo': UID 'urn:uuid:b8a26c8d-d605-45b0-8e15-cbabb8aa105d' NOT found!"
}
āš ļø Error creating task: {
    "error": 422,
    "message": "Error parsing JsTask attribute 'relatedTo': UID 'urn:uuid:b8a26c8d-d605-45b0-8e15-cbabb8aa105d' NOT found!"
}
šŸ”¹ Sending request to EGroupware: {
  "title": "Room 101: Vacuum the entire room and bathroom",
  "start": "2025-03-31T11:50:54.061220+00:00",
  "timeZone": "Europe/Warsaw",
  "description": "Task Parent: Room 101\n        Area: Hotel\n        Task: Vacuum the entire room and bathroom",
  "priority": 5,
  "participants": [
    {
      "@type": "participant",
      "name": "housekeeping",
      "uri": "principals/groups/housekeeping/",
      "email": "housekeeping@jesshotel.pl",
      "kind": "group",
      "roles": {
        "attendee": true
      }
    }
  ],
  "status": "confirmed",
  "progress": "needs-action",
  "relatedTo": {
    "urn:uuid:b8a26c8d-d605-45b0-8e15-cbabb8aa105d": {
      "@type": "Relation",
      "relation": "parent"
    }
  }
}
šŸ”¹ Response status: 422
šŸ”¹ Response text: {
    "error": 422,
    "message": "Error parsing JsTask attribute 'relatedTo': UID 'urn:uuid:b8a26c8d-d605-45b0-8e15-cbabb8aa105d' NOT found!"
}
āš ļø Error creating task: {
    "error": 422,
    "message": "Error parsing JsTask attribute 'relatedTo': UID 'urn:uuid:b8a26c8d-d605-45b0-8e15-cbabb8aa105d' NOT found!"
}
šŸ”¹ Sending request to EGroupware: {
  "title": "Room 101: Dust the desk, wardrobe, doors, windowsills, lamps",
  "start": "2025-03-31T11:50:54.129075+00:00",
  "timeZone": "Europe/Warsaw",
  "description": "Task Parent: Room 101\n        Area: Hotel\n        Task: Dust the desk, wardrobe, doors, windowsills, lamps",
  "priority": 5,
  "participants": [
    {
      "@type": "participant",
      "name": "housekeeping",
      "uri": "principals/groups/housekeeping/",
      "email": "housekeeping@jesshotel.pl",
      "kind": "group",
      "roles": {
        "attendee": true
      }
    }
  ],
  "status": "confirmed",
  "progress": "needs-action",
  "relatedTo": {
    "urn:uuid:b8a26c8d-d605-45b0-8e15-cbabb8aa105d": {
      "@type": "Relation",
      "relation": "parent"
    }
  }
}
šŸ”¹ Response status: 422
šŸ”¹ Response text: {
    "error": 422,
    "message": "Error parsing JsTask attribute 'relatedTo': UID 'urn:uuid:b8a26c8d-d605-45b0-8e15-cbabb8aa105d' NOT found!"
}
āš ļø Error creating task: {
    "error": 422,
    "message": "Error parsing JsTask attribute 'relatedTo': UID 'urn:uuid:b8a26c8d-d605-45b0-8e15-cbabb8aa105d' NOT found!"
}
šŸ”¹ Sending request to EGroupware: {
  "title": "Room 101: Clean the kettle and cups",
  "start": "2025-03-31T11:50:54.204182+00:00",
  "timeZone": "Europe/Warsaw",
  "description": "Task Parent: Room 101\n        Area: Hotel\n        Task: Clean the kettle and cups",
  "priority": 5,
  "participants": [
    {
      "@type": "participant",
      "name": "housekeeping",
      "uri": "principals/groups/housekeeping/",
      "email": "housekeeping@jesshotel.pl",
      "kind": "group",
      "roles": {
        "attendee": true
      }
    }
  ],
  "status": "confirmed",
  "progress": "needs-action",
  "relatedTo": {
    "urn:uuid:b8a26c8d-d605-45b0-8e15-cbabb8aa105d": {
      "@type": "Relation",
      "relation": "parent"
    }
  }
}
šŸ”¹ Response status: 422
šŸ”¹ Response text: {
    "error": 422,
    "message": "Error parsing JsTask attribute 'relatedTo': UID 'urn:uuid:b8a26c8d-d605-45b0-8e15-cbabb8aa105d' NOT found!"
}
āš ļø Error creating task: {
    "error": 422,
    "message": "Error parsing JsTask attribute 'relatedTo': UID 'urn:uuid:b8a26c8d-d605-45b0-8e15-cbabb8aa105d' NOT found!"
}
šŸ”¹ Sending request to EGroupware: {
  "title": "Room 101: Refill the coffee and tea set, leave a bottle of water",
  "start": "2025-03-31T11:50:54.283952+00:00",
  "timeZone": "Europe/Warsaw",
  "description": "Task Parent: Room 101\n        Area: Hotel\n        Task: Refill the coffee and tea set, leave a bottle of water",
  "priority": 5,
  "participants": [
    {
      "@type": "participant",
      "name": "housekeeping",
      "uri": "principals/groups/housekeeping/",
      "email": "housekeeping@jesshotel.pl",
      "kind": "group",
      "roles": {
        "attendee": true
      }
    }
  ],
  "status": "confirmed",
  "progress": "needs-action",
  "relatedTo": {
    "urn:uuid:b8a26c8d-d605-45b0-8e15-cbabb8aa105d": {
      "@type": "Relation",
      "relation": "parent"
    }
  }
}
šŸ”¹ Response status: 422
šŸ”¹ Response text: {
    "error": 422,
    "message": "Error parsing JsTask attribute 'relatedTo': UID 'urn:uuid:b8a26c8d-d605-45b0-8e15-cbabb8aa105d' NOT found!"
}
āš ļø Error creating task: {
    "error": 422,
    "message": "Error parsing JsTask attribute 'relatedTo': UID 'urn:uuid:b8a26c8d-d605-45b0-8e15-cbabb8aa105d' NOT found!"
}
šŸ”¹ Sending request to EGroupware: {
  "title": "Room 101: Check the hotel service brochure set, restock if necessary",
  "start": "2025-03-31T11:50:54.363272+00:00",
  "timeZone": "Europe/Warsaw",
  "description": "Task Parent: Room 101\n        Area: Hotel\n        Task: Check the hotel service brochure set, restock if necessary",
  "priority": 5,
  "participants": [
    {
      "@type": "participant",
      "name": "housekeeping",
      "uri": "principals/groups/housekeeping/",
      "email": "housekeeping@jesshotel.pl",
      "kind": "group",
      "roles": {
        "attendee": true
      }
    }
  ],
  "status": "confirmed",
  "progress": "needs-action",
  "relatedTo": {
    "urn:uuid:b8a26c8d-d605-45b0-8e15-cbabb8aa105d": {
      "@type": "Relation",
      "relation": "parent"
    }
  }
}
šŸ”¹ Response status: 422
šŸ”¹ Response text: {
    "error": 422,
    "message": "Error parsing JsTask attribute 'relatedTo': UID 'urn:uuid:b8a26c8d-d605-45b0-8e15-cbabb8aa105d' NOT found!"
}
āš ļø Error creating task: {
    "error": 422,
    "message": "Error parsing JsTask attribute 'relatedTo': UID 'urn:uuid:b8a26c8d-d605-45b0-8e15-cbabb8aa105d' NOT found!"
}
šŸ”¹ Sending request to EGroupware: {
  "title": "Room 101: Clean the ceiling and remove cobwebs",
  "start": "2025-03-31T11:50:54.445143+00:00",
  "timeZone": "Europe/Warsaw",
  "description": "Task Parent: Room 101\n        Area: Hotel\n        Task: Clean the ceiling and remove cobwebs",
  "priority": 5,
  "participants": [
    {
      "@type": "participant",
      "name": "housekeeping",
      "uri": "principals/groups/housekeeping/",
      "email": "housekeeping@jesshotel.pl",
      "kind": "group",
      "roles": {
        "attendee": true
      }
    }
  ],
  "status": "confirmed",
  "progress": "needs-action",
  "relatedTo": {
    "urn:uuid:b8a26c8d-d605-45b0-8e15-cbabb8aa105d": {
      "@type": "Relation",
      "relation": "parent"
    }
  }
}
šŸ”¹ Response status: 422
šŸ”¹ Response text: {
    "error": 422,
    "message": "Error parsing JsTask attribute 'relatedTo': UID 'urn:uuid:b8a26c8d-d605-45b0-8e15-cbabb8aa105d' NOT found!"
}
āš ļø Error creating task: {
    "error": 422,
    "message": "Error parsing JsTask attribute 'relatedTo': UID 'urn:uuid:b8a26c8d-d605-45b0-8e15-cbabb8aa105d' NOT found!"
}
šŸ”¹ Sending request to EGroupware: {
  "title": "Room 101: Clean the fridge, discard any leftover products",
  "start": "2025-03-31T11:50:54.520845+00:00",
  "timeZone": "Europe/Warsaw",
  "description": "Task Parent: Room 101\n        Area: Hotel\n        Task: Clean the fridge, discard any leftover products",
  "priority": 5,
  "participants": [
    {
      "@type": "participant",
      "name": "housekeeping",
      "uri": "principals/groups/housekeeping/",
      "email": "housekeeping@jesshotel.pl",
      "kind": "group",
      "roles": {
        "attendee": true
      }
    }
  ],
  "status": "confirmed",
  "progress": "needs-action",
  "relatedTo": {
    "urn:uuid:b8a26c8d-d605-45b0-8e15-cbabb8aa105d": {
      "@type": "Relation",
      "relation": "parent"
    }
  }
}
šŸ”¹ Response status: 422
šŸ”¹ Response text: {
    "error": 422,
    "message": "Error parsing JsTask attribute 'relatedTo': UID 'urn:uuid:b8a26c8d-d605-45b0-8e15-cbabb8aa105d' NOT found!"
}
āš ļø Error creating task: {
    "error": 422,
    "message": "Error parsing JsTask attribute 'relatedTo': UID 'urn:uuid:b8a26c8d-d605-45b0-8e15-cbabb8aa105d' NOT found!"
}
šŸ”¹ Sending request to EGroupware: {
  "title": "Room 101: Clean windows, frames, and windowsills (both sides)",
  "start": "2025-03-31T11:50:54.595860+00:00",
  "timeZone": "Europe/Warsaw",
  "description": "Task Parent: Room 101\n        Area: Hotel\n        Task: Clean windows, frames, and windowsills (both sides)",
  "priority": 5,
  "participants": [
    {
      "@type": "participant",
      "name": "housekeeping",
      "uri": "principals/groups/housekeeping/",
      "email": "housekeeping@jesshotel.pl",
      "kind": "group",
      "roles": {
        "attendee": true
      }
    }
  ],
  "status": "confirmed",
  "progress": "needs-action",
  "relatedTo": {
    "urn:uuid:b8a26c8d-d605-45b0-8e15-cbabb8aa105d": {
      "@type": "Relation",
      "relation": "parent"
    }
  }
}
šŸ”¹ Response status: 422
šŸ”¹ Response text: {
    "error": 422,
    "message": "Error parsing JsTask attribute 'relatedTo': UID 'urn:uuid:b8a26c8d-d605-45b0-8e15-cbabb8aa105d' NOT found!"
}
āš ļø Error creating task: {
    "error": 422,
    "message": "Error parsing JsTask attribute 'relatedTo': UID 'urn:uuid:b8a26c8d-d605-45b0-8e15-cbabb8aa105d' NOT found!"
}
šŸ”¹ Sending request to EGroupware: {
  "title": "Room 101: Wipe the entrance door to the room and bathroom",
  "start": "2025-03-31T11:50:54.676634+00:00",
  "timeZone": "Europe/Warsaw",
  "description": "Task Parent: Room 101\n        Area: Hotel\n        Task: Wipe the entrance door to the room and bathroom",
  "priority": 5,
  "participants": [
    {
      "@type": "participant",
      "name": "housekeeping",
      "uri": "principals/groups/housekeeping/",
      "email": "housekeeping@jesshotel.pl",
      "kind": "group",
      "roles": {
        "attendee": true
      }
    }
  ],
  "status": "confirmed",
  "progress": "needs-action",
  "relatedTo": {
    "urn:uuid:b8a26c8d-d605-45b0-8e15-cbabb8aa105d": {
      "@type": "Relation",
      "relation": "parent"
    }
  }
}
šŸ”¹ Response status: 422
šŸ”¹ Response text: {
    "error": 422,
    "message": "Error parsing JsTask attribute 'relatedTo': UID 'urn:uuid:b8a26c8d-d605-45b0-8e15-cbabb8aa105d' NOT found!"
}
āš ļø Error creating task: {
    "error": 422,
    "message": "Error parsing JsTask attribute 'relatedTo': UID 'urn:uuid:b8a26c8d-d605-45b0-8e15-cbabb8aa105d' NOT found!"
}

Ok, there was a missing backport, therefore the fix was NOT in the last maintenance release :frowning:

You need to patch the following 2 commits into your 23.1.20250307 container:

When the two commits are added to your container, relatedTo will be parsed also with ā€œurn:uuid:ā€ prefix:

cat <<EOF|curl -i -X POST https://boulder.egroupware.org/epl-23.1/groupdav.php/infolog/ -H "Content-Type:application/json" -H "Accept: application/pretty+json" -H "Prefer:return=representation" -d @- --user sysop
{"@type":"Task","title":"Subtask","start":"20250403T100000","timeZone":"Europe/Berlin","description":"Just a 2nd test","relatedTo":{"urn:uuid:c8e7e42d-e0dd-433b-bf99-1f6e778a75ea":{"@Type":"Relation","relation":"parent"}}} 
EOF
Enter host password for user 'sysop':

HTTP/1.1 201 Created
Server: nginx/1.26.3
Date: Thu, 03 Apr 2025 07:45:08 GMT
Content-Type: application/jscalendar+json;type=task;charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
X-Dav-Powered-By: EGroupware 23.1.011 CalDAV/CardDAV/GroupDAV server
Location: /epl-23.1/groupdav.php/infolog/10
Content-Location: https://boulder.egroupware.org/epl-23.1/groupdav.php/infolog/10
Content-Encoding: identity
ETag: "10:0:1743673508"
X-WebDAV-Status: 201 Created
X-Content-Type-Options: nosniff

{
    "@type": "Task",
    "prodId": "EGroupware InfoLog 23.1.011",
    "uid": "urn:uuid:ff7ce4a9-1af5-4d4d-8ff4-f6665b61b3b3",
    "created": "2025-04-03T07:45:08Z",
    "title": "Subtask",
    "start": "2025-04-03T10:00:00",
    "timeZone": "Europe/Berlin",
    "description": "Just a 2nd test",
    "participants": {
        "6": {
            "@type": "Participant",
            "name": "Admin User",
            "kind": "individual",
            "roles": { "owner": true }
        }
    },
    "status": "confirmed",
    "progress": "completed",
    "priority": 9,
    "privacy": "public",
    "egroupware.org:type": "task",
    "relatedTo": {
        "c8e7e42d-e0dd-433b-bf99-1f6e778a75ea": {
            "@type": "Relation",
            "relation": "parent"
        }
    }
}

Thanks for reporting that back :slight_smile:

Ralf