zesty.io

Product

Use Cases

Integrations

Learn

Export Content Model to CSV

You can export a model's content items to a Comma Separated Value file by using a GET request to the cloud function contentToolsModeltoCSV or by writing your own NodeJS script.

Content Model to CSV

https://us-central1-zesty-prod.cloudfunctions.net/contentToolsModeltoCSV

Write your Own CSV Export

If you are looking for a more custom export, here is the the node code to export a Content Model to a CSV using the Node SDK.

const SDK = require("@zesty-io/sdk");
const modelZUID = "6-xxx-xxxxx";
const instanceZUID = "8-xxx-xxxxx";
const authToken = "XXXXX";
const sdk = new SDK(instanceZUID, token);
let items = await sdk.instance.getItems(modelZUID);
let header = [];
let itemData = []; // start the headersheader.push({id: 'zuid', title: 'zuid'})

header.push({ id: "url", title: "url" }); // create the csv headers based on the content (data) row

for (let [key, value] of Object.entries(items.data[0].data)) {
  header.push({ id: key, title: key });
}

items.data.map(async (item) => {
  item.data.url = item.web.path ? item.web.path : null;
  item.data.zuid = item.meta.ZUID;
  console.log(item.data);
  itemData.push(item.data);
}); // take first item and convert it to a header

const createCsvStringifier = require("csv-writer").createObjectCsvStringifier;
const csvStringifier = createCsvStringifier({ header: header });
let csvstring =
  csvStringifier.getHeaderString() + csvStringifier.stringifyRecords(itemData);
  
console.log(csvstring);

Start Here

We will listen to your needs and walk you through how Zesty can help your team.

Connect with Content Experts

Book a free 15-minute consultation with a content expert. Discuss your application, pain points and requirements. Understand how Zesty's lower total cost of ownership, features, functionality can elevate your business by creating extraordinary digital experiences.

Trusted By

zesty customer logo Sonyzesty customer logo Rocket Leaguezesty customer logo Singlifezesty customer logo Acornszesty customer logo Phoenix Sunszesty customer logo Wattpadzesty customer logo Corner Shopzesty customer logo Bjs

G2 MOMENTUM LEADER

zesty customer logo zesty customer logo zesty customer logo zesty customer logo

Enter your details to connect with a Content Expert

First Name

Last Name

Email

Phone (optional)

Company

Please tell us about your project (optional)