Importing A12 documents (and relationships) from a different system

We are migrating an existing solution (using Liferay, but that’s not important) to A12 (2024.06-ext5)

As the old system contains important data, we need to migrate that data to A12 documents.

We can easily convert the (Liferay) data into A12 documents and relationships as we can generated the needed DocRefs during the export.

However, it’s unclear to me how we can import those documents and relationships using RPC. To my knowledge the ADD_DOCUMENT RPC call doesn’t work when a DocRef is provided, so we can’t use the IDs we generate ourselves.

As far as I can tell, we need to write an A12 (client) application that reads the exported JSON files, creates the A12 documents using ADD_DOCUMENT and stores the generated ID from A12 (together with the original ID). Once all documents are created, that program needs to go through list of generated IDs and call ADD_LINK for each of them.

Do I understand that correctly, or is there an easier way? e.g. through Bruno requests?

In AASH, we pretty much use the same mechanism (even thou we’re importing from Access and do it in the backend entirely): (a) Identify the document by its ID from the external system (b) create a new document (c) use that docRef for further processing. This is particularly painful in our backup/restore functionality where we restore models, docs, attachments, relations from a zip file. So, an “insert with id” functionality would be helpful for us, too.

In our case it’s even more complicated as we only deploy models, no back end code at all.

Btw: in 2025.06 you could use the “import seed data” to import your ZIP file I think.

Interesting. Would have to rewrite our “backup” functionality to match the required file structure, but might have a closer look later on. Once the “for testing and demo purposes only” hint has disappeared…

You can use placeholders for docrefs of documents created in the same batch operation and use those in the ADD_LINK operation - it’s documented with an example (having said that: I needed Tomas B’s help to find it) here: GetA12