Importing data with relationships

Help! I'm really stuck and despite searching can't quite figure out how to move forward.

I have two customer content types: Families and People. Families have links to People.

I have about 3,500 families to load up and have created a script to generate the necessary json to load up the People using the Bulk Import zipped json mechanism. All fine so far (one or two tests run but not for the full quantity yet..).

As I prepare the script to create the json for the Families, I need to reference the right people. I've looked at the docs, and it suggests that the only way to do this is with via the document id and woi.

But how do I get the document id? Do I have to query the API to get this? Is there an easier way to load up content?

Can someone offer a bit of guidance on this? Is there an altogether better way of doing this?

Could I use the document uid instead of id? That would make it SO much easier!

Thanks!!

Hi Andrzej,

Thanks for your contribution to the Prismic community,
I gathering some information about the possible solutions and I will get back to you once I get any info,

Fares

Thanks Fares. I'm doing my best to work around it, but I think the ability to be able to use either the id OR uid within the json for content importing for linking content would be a great feature.

I'm having a go at prepping my first code generated json files this evening, to populate my "Person" custom type... fingers crossed that will work nice and smoothly!

1 Like

Unfortunately, such a feature doesn't exist, and I will create a feature request to allow importing linked docs.

Here is a way to solve this that is a bit complicated but might do the job (I haven't tested it yet).

The idea is to create an Id for the docs that need to be linked (using a script) and add those ids to both the original document and the document to be liked to.

import all documents (to generate Prismic IDs), then export all the documents and have a script to find the matching ids and link them using a script and then reimport again

1 Like

This is being tracked as an open feature request.

If you have another use-case for this feature, you can 'Flag' this topic to reopen. Please use the :heart: button to show your support for the feature and check out our Feature Request Guidelines.

Hey Fares & Andrzej,
Is there an update for this issue?

Hello @withloveinternet. For the moment, we have no updates about this feature.