Exporting data and backups

Hello,

I can see the code snippet here Exporting data and backups — DatoCMS 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

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:

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:

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