Conversation
|
For completeness sake - this returning an empty list is not new. It was also in older builds it seems, so is not due to this PR. This does return something though: query GetVersionLinks {
project(name: "test") {
versions(ids: "fa03f536-1ec3-11f1-98b1-60cf848a5b16"){
edges {
node {
links {
edges {
entityId
linkType
data
}
}
}
}
}
}
}Returning: {
"data": {
"project": {
"versions": {
"edges": [
{
"node": {
"links": {
"edges": [
{
"entityId": "f9d4aa9e1ec311f1ae7160cf848a5b16",
"linkType": "generative",
"data": {}
},
{
"entityId": "fe3162a05b2711f099b83c0af39c4c02",
"linkType": "reference",
"data": {}
},
{
"entityId": "5c575e305cc411f090013c0af39c4c02",
"linkType": "reference",
"data": {}
},
{
"entityId": "f77bf84a1d9711f1942460cf848a5b16",
"linkType": "reference",
"data": {}
}
]
}
}
}
]
}
}
}
} |
|
Ok, found it. version_id = "fa03f536-1ec3-11f1-98b1-60cf848a5b16"
print(ayon_api.get_version_links("test", version_id, link_types=["reference"], link_direction="in"))
print(ayon_api.get_versions_links("test", [version_id], link_types=["reference"], link_direction="in"))The latter does print the output, the first prints the empty list. defaultdict(<class 'list'>, {'fa03f5361ec311f198b160cf848a5b16': [{'linkType': 'reference', 'direction': 'in', 'id': 'fa8a7e681ec311f18c9592a342bf613b', 'description': 'reference link with input version and output version', 'entityId': 'fe3162a05b2711f099b83c0af39c4c02', 'name': None, 'author': 'bigroy', 'entityType': 'version', 'projectName': 'test'}, {'linkType': 'reference', 'direction': 'in', 'id': 'fa93a3d01ec311f18c9592a342bf613b', 'description': 'reference link with input version and output version', 'entityId': '5c575e305cc411f090013c0af39c4c02', 'name': None, 'author': 'bigroy', 'entityType': 'version', 'projectName': 'test'}, {'linkType': 'reference', 'direction': 'in', 'id': 'fa9b4df61ec311f18c9592a342bf613b', 'description': 'reference link with input version and output version', 'entityId': 'f77bf84a1d9711f1942460cf848a5b16', 'name': None, 'author': 'bigroy', 'entityType': 'version', 'projectName': 'test'}]})As such, the value isn't in the version_id = "fa03f5361ec311f198b160cf848a5b16"
print(ayon_api.get_version_links("test", version_id, link_types=["reference"], link_direction="in"))And voila, this does print something. version_id = "f9d4aa9e-1ec3-11f1-ae71-60cf848a5b16".replace("-", "")
print(ayon_api.get_version_links("test", version_id, link_direction="in"))[{'author': 'bigroy',
'data': {},
'description': 'generative link with input version and output version',
'direction': 'in',
'entityId': 'fa03f5361ec311f198b160cf848a5b16',
'entityType': 'version',
'id': 'fa70d4861ec311f18c9592a342bf613b',
'linkType': 'generative',
'name': None,
'projectName': 'test'},
{'author': 'bigroy',
'data': {'hero': True, 'hero_version_id': 'fe3162a05b2711f099b83c0af39c4c02'},
'description': 'generative link with input version and output version',
'direction': 'in',
'entityId': '5c575e305cc411f090013c0af39c4c02',
'entityType': 'version',
'id': 'fa79b4e81ec311f18c9592a342bf613b',
'linkType': 'generative',
'name': None,
'projectName': 'test'}]Note that data does indeed now get included. |
BigRoy
left a comment
There was a problem hiding this comment.
Works. There is the caveat that with certain api calls using ids with - in them does not return any data, like described here because it seems they are stripped on the returned id. Not sure if that should be handled more gracefully?
|
Not sure where did you get version id with dashes? |

Changelog Description
Fetch links data if server does support it.
Additional review information
Data can be fetched since AYON server 1.14.2 so it is quite new feature and can't be added all the time.
Testing notes: