Entity Linking using Entity Data

Our products are structured into a Class->Family->Product structure. In our CMS (Drupal) we use entity (node) relationships to link them together into this hierarchy. The JSON for these object that’s returned from the website includes the parent-child relationships, however, the data that’s returned is the node ID. Product A’s Entity has relationship to its parent node ID, say 12345. The corresponding parent Entity in Yext includes this node ID as well.

So, it’s certainly possible to link the two Yext Entities together. The question is how to build that linkage? It could be done manually, of course, but we have thousands of products, so that’s out of the question. Is there some programmatic/automated way to do this? Has anyone encountered a similar scenario and solved the problem, perhaps in a way that’s not occurring to me?