From bf31c8568bdec6d428393d48b365ba856dc61bd4 Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Fri, 9 Jan 2026 17:56:13 +0100 Subject: [PATCH 1/5] list items are not fetched by default --- ayon_api/_api_helpers/lists.py | 18 +++++++++++++++++- ayon_api/constants.py | 4 ---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/ayon_api/_api_helpers/lists.py b/ayon_api/_api_helpers/lists.py index b6bd79265..3d637d05d 100644 --- a/ayon_api/_api_helpers/lists.py +++ b/ayon_api/_api_helpers/lists.py @@ -26,7 +26,15 @@ def get_entity_lists( active: Optional[bool] = None, fields: Optional[Iterable[str]] = None, ) -> Generator[dict[str, Any], None, None]: - """Fetch entity lists from server. + """Fetch entity lists from AYON server. + + Warnings: + You can't get list items for lists with different 'entityType' in + one call. + + Notes: + To get list items, you have to pass 'items' field or + 'items.{sub-fields you want}' to 'fields' argument. Args: project_name (str): Project name where entity lists are. @@ -43,6 +51,14 @@ def get_entity_lists( if fields is None: fields = self.get_default_fields_for_type("entityList") fields = set(fields) + if "items" in fields: + fields.discard("items") + fields |= { + "items.id", + "items.entityId", + "items.entityType", + "items.position", + } if active is not None: fields.add("active") diff --git a/ayon_api/constants.py b/ayon_api/constants.py index 21d75e324..895cff73e 100644 --- a/ayon_api/constants.py +++ b/ayon_api/constants.py @@ -259,8 +259,4 @@ "tags", "updatedAt", "updatedBy", - "items.id", - "items.entityId", - "items.entityType", - "items.position", } From 8a4d73c7f6904812356f259af1d5979f12fc20d3 Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Fri, 9 Jan 2026 17:56:37 +0100 Subject: [PATCH 2/5] fix available attribs for list entities --- ayon_api/server_api.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ayon_api/server_api.py b/ayon_api/server_api.py index 9df64fbb2..80d940086 100644 --- a/ayon_api/server_api.py +++ b/ayon_api/server_api.py @@ -1956,6 +1956,8 @@ def get_default_fields_for_type(self, entity_type: str) -> set[str]: elif entity_type == "entityList": entity_type_defaults = set(DEFAULT_ENTITY_LIST_FIELDS) + # Attributes scope is 'list' + entity_type = "list" else: raise ValueError(f"Unknown entity type \"{entity_type}\"") From 73a4d5e1c075228f2c03cc8a3faa4c50d356c0b8 Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Fri, 9 Jan 2026 17:56:53 +0100 Subject: [PATCH 3/5] allow attribs fetch for lists by default --- ayon_api/_api_helpers/lists.py | 26 +++++++++++++++++++++++++- ayon_api/constants.py | 1 + 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/ayon_api/_api_helpers/lists.py b/ayon_api/_api_helpers/lists.py index 3d637d05d..b8dd49d0a 100644 --- a/ayon_api/_api_helpers/lists.py +++ b/ayon_api/_api_helpers/lists.py @@ -50,7 +50,18 @@ def get_entity_lists( """ if fields is None: fields = self.get_default_fields_for_type("entityList") - fields = set(fields) + + # List does not have 'attrib' field but has 'allAttrib' field + # which is json string and contains only values that are set + o_fields = tuple(fields) + fields = set() + requires_attrib = False + for field in o_fields: + if field == "attrib" or field.startswith("attrib."): + requires_attrib = True + field = "allAttrib" + fields.add(field) + if "items" in fields: fields.discard("items") fields |= { @@ -60,6 +71,10 @@ def get_entity_lists( "items.position", } + available_attribs = [] + if requires_attrib: + available_attribs = self.get_attributes_for_type("list") + if active is not None: fields.add("active") @@ -82,6 +97,15 @@ def get_entity_lists( if isinstance(attributes, str): entity_list["attributes"] = json.loads(attributes) + if requires_attrib: + all_attrib = json.loads( + entity_list.get("allAttrib") or "{}" + ) + entity_list["attrib"] = { + attrib_name: all_attrib.get(attrib_name) + for attrib_name in available_attribs + } + self._convert_entity_data(entity_list) yield entity_list diff --git a/ayon_api/constants.py b/ayon_api/constants.py index 895cff73e..e39fc175f 100644 --- a/ayon_api/constants.py +++ b/ayon_api/constants.py @@ -247,6 +247,7 @@ DEFAULT_ENTITY_LIST_FIELDS = { "id", "count", + "allAttrib", "attributes", "active", "createdBy", From b03c34f64179dbfb7bd7f27c8778d2f5376a2651 Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Fri, 9 Jan 2026 17:57:01 +0100 Subject: [PATCH 4/5] fix endpoint used to create new list --- ayon_api/_api_helpers/lists.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ayon_api/_api_helpers/lists.py b/ayon_api/_api_helpers/lists.py index b8dd49d0a..9c992b2b8 100644 --- a/ayon_api/_api_helpers/lists.py +++ b/ayon_api/_api_helpers/lists.py @@ -210,9 +210,8 @@ def create_entity_list( kwargs[key] = value response = self.post( - f"projects/{project_name}/lists/{list_id}/items", + f"projects/{project_name}/lists", **kwargs - ) response.raise_for_status() return list_id From b6a6527c124eda5b078d5abe6d65a18d484efc93 Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Fri, 9 Jan 2026 17:57:16 +0100 Subject: [PATCH 5/5] use correct method to update list items --- ayon_api/_api_helpers/lists.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ayon_api/_api_helpers/lists.py b/ayon_api/_api_helpers/lists.py index 9c992b2b8..df22e3844 100644 --- a/ayon_api/_api_helpers/lists.py +++ b/ayon_api/_api_helpers/lists.py @@ -382,7 +382,7 @@ def update_entity_list_items( mode (EntityListItemMode): Mode of items update. """ - response = self.post( + response = self.patch( f"projects/{project_name}/lists/{list_id}/items", items=items, mode=mode,