Exporting data and backups


I can see the code snippet here https://www.datocms.com/docs/import-and-export/export-data but I don’t actually know how to go about using this.

I’d like to take a backup of all of the data content in my project. Please can someone explain the steps?

Thank you!

It’s a NodeJS script @steven. Paste the code into a .js file (ie. run.js), install the required dependencies which are datocms-client and request in this case with:

npm install --save datocms-client request

And then run the script with:

node run.js
1 Like

Hi @s.verna, thank you!

That’s working perfectly :slight_smile:

In the snippet, it references allPages but looking at the records.json file It appears to export all of the different models and not just pages. Is that correct?

allPages simply mean “paginate all the results, and get every record” :slight_smile:

1 Like

Thank you! :slight_smile:

I don’t need to do a data restore, but is there a process for that also?

Of course it’s possible with our REST API, but it will be more complicated than a single generic script :slight_smile:

1 Like

Ok, thank you that’s good to know for the future!