Step 4: Associate a List with an Entity
You’ve now created a few Menus and reviewed their data, but you haven’t made an association between the created Menus and an existing entity in the Knowledge Graph. Lists can be associated with (or disassociated from) an Entity by sending an
Entities: Update
request that specifies the List’s id
in the corresponding List IDs field for the Entity (in the case of Menus, menus
). So, to add the first Menu we created, you would make a request like this:
Example Request:
PUSH | https://api.yextapis.com/v2/accounts/{accountId}/entities/{entityId}?api_key=API_KEY&v=YYYYMMDD |
Example Response:
{
"menus": {
"ids": ["breakfast01"],
"label": "Restaurant Menus"
}
}
You can verify that the List was associated with the Entity by issuing an
Entities: GET
request. Yext will syndicate your Menu to the Publisher Network if its publish
field is set to true (and your entity has the correct license assigned). So, if you add a List with the publish
field set to false
, that List will not be syndicated to the Publisher Network and will not appear on any of your Listings.
The label
sub-field contains the hyperlink text that is shown on your Listings. In our example, consumers will see a button with the words “Restaurant Menus” when viewing your Listing on a Publisher site. When they click on the button, all of the Menus that are both published and associated with the Listing’s location will be displayed.
NOTE: If you have created multiple Menus and associated them with an Entity, they will all appear under the same label
on the publisher’s site.
To remove this Menu from the Entity, you can make another
Entities: Update
request, but this time, omit the Menu’s id
from menu.ids
, or provide an empty menus object.
Example Request:
Example Response:
{
"menus": {}
}
Take a moment to add and remove a few Menus from one of your example Entities.