Public api: Create link has 'data' argument#308
Conversation
There was a problem hiding this comment.
I don't get the data returned from the link:
import ayon_api
import os
os.environ["AYON_SERVER_URL"] = "http://localhost:5000"
os.environ["AYON_API_KEY"] = "54f2c159eedc4b5fa10447571161e978"
project_name = "test"
folder_a = ayon_api.get_folder_by_path("test", "/apps/blender")
folder_b = ayon_api.get_folder_by_path("test", "/apps/maya")
link_type_name = "breakdown"
ayon_api.create_link(
project_name=project_name,
link_type_name=link_type_name,
input_id=folder_a["id"],
input_type="folder",
output_id=folder_b["id"],
output_type="folder",
link_name="MyLink",
data={"foo": "bar", "hello": "world"},
)
print(ayon_api.get_folder_links(
project_name,
folder_b["id"],
link_types=[link_type_name])
)
# This fails to work.[{'direction': 'in', 'linkType': 'breakdown', 'name': 'MyLink', 'description': 'breakdown link with input folder and output folder', 'entityType': 'folder', 'author': 'deadline', 'projectName': 'test', 'id': '64df3768129911f19082ee69ed383011', 'entityId': '0867b2404af211f0985a3b9388bc26af'}, {'direction': 'in', 'linkType': 'breakdown', 'name': 'MyLink', 'description': 'breakdown link with input folder and output folder', 'entityType': 'folder', 'author': 'deadline', 'projectName': 'test', 'id': 'ab7d5fec129911f19082ee69ed383011', 'entityId': '0867b2404af211f0985a3b9388bc26af'}, {'direction': 'in', 'linkType': 'breakdown', 'name': 'MyLink', 'description': 'breakdown link with input folder and output folder', 'entityType': 'folder', 'author': 'deadline', 'projectName': 'test', 'id': 'b2508236129911f19082ee69ed383011', 'entityId': '0867b2404af211f0985a3b9388bc26af'}, {'direction': 'in', 'linkType': 'breakdown', 'name': 'MyLink', 'description': 'breakdown link with input folder and output folder', 'entityType': 'folder', 'author': 'deadline', 'projectName': 'test', 'id': 'd5131b80129911f19082ee69ed383011', 'entityId': '0867b2404af211f0985a3b9388bc26af'}, {'direction': 'in', 'linkType': 'breakdown', 'name': 'MyLink', 'description': 'breakdown link with input folder and output folder', 'entityType': 'folder', 'author': 'deadline', 'projectName': 'test', 'id': 'dcfa442c129911f19082ee69ed383011', 'entityId': '0867b2404af211f0985a3b9388bc26af'}]
Not related to this PR. Without this PR you could not call the |
I understand - but adding the I also can't seem to get the link data via GraphQL @martastain (not exposed?)? Anyway, without the data being present I can't confirm this PR does what it should? |
There was a problem hiding this comment.
PR works.
You can check the data via GraphQL with ynput/ayon-backend#867
Otherwise via the manage.ps1 dbshell and doing something like:
SELECT * FROM project_{projectname}.links WHERE data != '{}';
Resulting in:
ayon=# SELECT * FROM project_test.links WHERE data != '{}';
id | name | link_type | input_id | output_id | author | data | created_at | creation_order
--------------------------------------+--------+-------------------------+--------------------------------------+--------------------------------------+----------+----------------------------------+-------------------------------+----------------
64df3768-1299-11f1-9082-ee69ed383011 | MyLink | breakdown|folder|folder | 0867b240-4af2-11f0-985a-3b9388bc26af | 6844a8a0-2737-11f0-8312-29f47de0c09d | deadline | {"foo": "bar"} | 2026-02-25 22:29:05.684429+00 | 532
ab7d5fec-1299-11f1-9082-ee69ed383011 | MyLink | breakdown|folder|folder | 0867b240-4af2-11f0-985a-3b9388bc26af | 6844a8a0-2737-11f0-8312-29f47de0c09d | deadline | {"foo": "bar"} | 2026-02-25 22:31:04.161401+00 | 533
b2508236-1299-11f1-9082-ee69ed383011 | MyLink | breakdown|folder|folder | 0867b240-4af2-11f0-985a-3b9388bc26af | 6844a8a0-2737-11f0-8312-29f47de0c09d | deadline | {"foo": "bar"} | 2026-02-25 22:31:15.611413+00 | 534
d5131b80-1299-11f1-9082-ee69ed383011 | MyLink | breakdown|folder|folder | 0867b240-4af2-11f0-985a-3b9388bc26af | 6844a8a0-2737-11f0-8312-29f47de0c09d | deadline | {"foo": "bar"} | 2026-02-25 22:32:13.929273+00 | 535
dcfa442c-1299-11f1-9082-ee69ed383011 | MyLink | breakdown|folder|folder | 0867b240-4af2-11f0-985a-3b9388bc26af | 6844a8a0-2737-11f0-8312-29f47de0c09d | deadline | {"foo": "bar", "hello": "world"} | 2026-02-25 22:32:27.188238+00 | 536
664dc2b8-1348-11f1-8055-7ae238a541a5 | MyLink | breakdown|folder|folder | 0867b240-4af2-11f0-985a-3b9388bc26af | 6844a8a0-2737-11f0-8312-29f47de0c09d | deadline | {"foo": "bar", "hello": "world"} | 2026-02-26 19:21:50.014271+00 | 540
24c9a63a-1349-11f1-8055-7ae238a541a5 | MyLink | breakdown|folder|folder | 0867b240-4af2-11f0-985a-3b9388bc26af | 6844a8a0-2737-11f0-8312-29f47de0c09d | deadline | {"foo": "bar", "hello": "world"} | 2026-02-26 19:27:09.593337+00 | 541
f6bdffec-1358-11f1-8adc-3298230c2905 | MyLink | breakdown|folder|folder | 0867b240-4af2-11f0-985a-3b9388bc26af | 6844a8a0-2737-11f0-8312-29f47de0c09d | deadline | {"foo": "bar", "hello": "world"} | 2026-02-26 21:20:24.289475+00 | 543
Changelog Description
Public api function
create_linkdoes havedataargument now.Additional review information
Without this PR it is not possible to pass
datato public functioncreate_linkinstead developer has to get the connection object and call it on that.Testing notes:
datato publiccreate_linkfunction.