Skip to main content

 How to get the catalog item related to the main catalog item via API?

 

Please help me to get that API.

Hello ​@Hanish N ,

catalog item relationships are stored in an entity called catalogItemRelationship. You can download the instances using ONE Metadata Reader:

The source is the ID of the source catalog item, target is the ID of the target catalog item and type is ID of the relationship type (e.g. parent-child). If you then want to get details of the items (like names) and name of the relationship, you have to further join with the catalog item entities and the relationshipType entity using those IDs.

Using graphql API, this is the same query:

query q{
catalogItemRelationships(versionSelector: {draftVersion: true}){
edges{
node{
gid
publishedVersion{
source{
gid
publishedVersion{
name
}
}
target{
gid
publishedVersion{
name
}
}
type{
gid
publishedVersion{
name
}
}
}
}
}
}
}

It gives you all CI relationships, including the table names and relationship type name.

 

Let me know if this helps.

Kind regards,

Anna


Reply