How to associate variants with their main-component's name via the API?

I have a Tooltip component variant and it returns as this via the Rest API:

"21067:257": {
    "key": "7cd98dcc2b6254c6748612e6154a91736f27ba7b",
    "name": "Arrow Position=left, Resizable=false, Color=dark",
    "description": ""
},
"21067:269": {
    "key": "50a3029f71543ccb93264de6de85fa97b666c25b",
    "name": "Arrow Position=left, Resizable=false, Color=brand",
    "description": ""
},
"21067:281": {
    "key": "7e1aaf60fc46e77d9cfc6790e388dc3f35067b5d",
    "name": "Arrow Position=left, Resizable=false, Color=light",
    "description": ""
},

I’m trying to search for ‘Tooltip’ by name and return a list of matching components. The name property on a variant lacks any correlation back to the main-component name, in this case Tooltip.

Looking for guidance on how to associate them, ideally not having to fill in a description with the name for each one.

I suppose I could search on the document children instead and walk the tree of COMPONENT_SETS and make some determinations

1 Like

I ran into the same problem. I assumed that when doing a get file request you would have both the variant state name and the component set name “Tooltip”.

Did you find any way around it other then adding it to the description ?

Did you figure out how to solve this?

@Bryan_Berger, @Matan_Arbel, @Daniel_Buitrago_Jara, you can use the GET file nodes endpoint.

For example, output where node-id is equal:

  • ComponentSetId
    REST-API-ComponentSetNodeId

  • ComponentId (Variant)
    REST-API-ComponentNodeId-(Variant)

@tank666
Thats what we ended up doing :melting_face:
the issue with that is having to do more API calls - when you have a big organizations it turn into a heavy thing to run across all teams.

It would be a great time saver to have the components set Key and name as part of the variant data structure on top of the componentSetId Or the other way around.

at least for our use-case :}

1 Like

Hello Guys, ca you tell me where i can find the ComponentID of a Component?

Use endpoints that you can use to get node ids, such as GET file or GET team components, or GET file components, or GET component.