How to use Migration API with multiple locales?

As title stated, how to use Migration API with multiple locales? As far as I know, it's only possible to POST with one locale, and PUT method is ignoring lang property.

After watch this video, just found out that you can create (POST) a document and then take its id to alternate_language_id to link it.

    const createInDefaultLang = await create({
      uid,
      lang: "vi",
      type,
      data: item.vi,
      title: item.vi.name,
    });

    if (createInDefaultLang.id) {
      await create({
        alternate_language_id: createInDefaultLang.id,
        uid,
        lang: "en",
        type,
        data: item.en,
        title: item.en.name,
      });
    }
1 Like