Export / Import Models and Content

Hey hey,
we want to export our Content and Models sorted in JSON Files. We are able to use this (Exporting data and backups - DatoCMS) but thats only for all content unfiltered and not for the models. So what can i do with that? How can i import it to datoCMS without having the models?
Is there any way to export the Schema and the Content? And import both?
Thank you very much!
Have a nice day.
Best regards

hello @m.wiskow96 to export the models you need to write a similar script, listing all models: https://www.datocms.com/docs/content-management-api/resources/item-type/instances and fields: List all fields - Field - Content Management API

For the import instead is a different story, you need to write a script yourself, but it’s a bit more complex.

The example export was more meant as a way to backup all your content out of DatoCMS, not as an export/import functionality.

What’s your use case for that?

Is it possible to export the models into the migrations format.
So that the current state of the model is exported as a migration create file?

Hello @K-user and welcome to Community!

The migration files are just JS scripts in which you write the steps that should happen in the “migration”, the actual change of schema and possibly content as well.

If you want to export the models, you can use the REST API here: Model/Block - Content Management API to get the models list and then you can retrieve the fields: Field - Content Management API

You can save the JSON of the models/fields and reuse them in another instance. Makes sense?

Thx for the explanation.

1 Like