Link Existing Objects
The link
option allows you to link existing objects to a “parent” object.
In the “parent” input object (whether in a createObject
or updateObject
mutation) where the object has relationships defined to other objects, a relationships field should be available. This object will include a list of objects that relationships can be linked to, and within the relationship input the link
input allows you to link preexisting objects.
The body of the link field can be either a single string or an array of strings to link multiple objects.
Example 1: Linking a single object
mutation updateSeason {
updateSeason(uid: "<season UID>", season: {
relationships: {
episodes: {
link: "<episode UID>"
}
}
}
)
{
uid
episodes {
uid
}
}
}
Example 2: Linking multiple objects
mutation updateSeason {
updateSeason(uid: "<season UID>", season: {
relationships: {
episodes: {
link: ["<episode UID>", "<another episode UID>"]
}
}
}
)
{
uid
episodes {
uid
}
}
}
Updated 4 months ago