How to create parent-child relation using the Entity Service API?

System Information
  • Strapi Version: 4.4.1
  • Operating System: mac
  • Database: postgre
  • Node Version: 16.
  • NPM Version:
  • Yarn Version:

can’t find doc on how to create a relationship using the Entity Service API.
CRUD operations are described here: CRUD operations with Entity Service API - Strapi Developer Docs

in the doc here for the .create() it says “populate Relations, components and dynamic zones to populate”.

But on the populate page there are only examples for findMany() - but not for create()

Do you know how to create a parent-child relation using the Entity Service API?

1 Like

Hey @terchris did you find any solution for this issue?

in make case I am using in this way:
I have CSV file to do by cron function and every day they update NAV and the date, product and share class are relationship and they have been created before, so only I need to pass the id of them: and it works fine.
maybe is not what you are looking for. :slight_smile:

const newItem = await strapi.entityService.create('api::nav.nav', {
          data: {
            nav: itemFromCSVFile.nav,
            product: itemFromCSVFile.product,
            share_class: itemFromCSVFile.share_class