How to import data

I’ve seen the tutorials on importing data from WordPress and Contentful, but I haven’t been able to figure out how to import from other sources. Is this possible? I have data that will be pulled from a WordPress site, but I don’t want to do a full import because we’re only reusing certain post types. My thought is that I would export the specific data from WordPress and then upload to Dato, but I haven’t been able to find info in the docs about how to do that. If there’s a way to do a partial import through datocms-client, that would work too. I’m mostly just trying to find a way to get the data into Dato without recreating 4K or so articles. Thanks!

@jdozierezell it is possible to import data from other sources if you write the script yourself using the REST APIs: https://www.datocms.com/docs/content-management-api

If you want to import from WordPress though we have a script that works for a classic blog. If you need to import custom post types though you need to customise it a bit. Here’s the main command: https://github.com/datocms/js-datocms-client/blob/master/src/wpImport/command.js

You should customise the schema creation adding your custom post types here: https://github.com/datocms/js-datocms-client/blob/master/src/wpImport/createSchema.js

And then you should add a new importer similar to this: https://github.com/datocms/js-datocms-client/blob/master/src/wpImport/import/articles.js

Let me know if you hit any blocker, if you want to start a repo on Github by forking our client I can try helping out!

2 Likes