Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Creating content in Cloud CMS using the Gitana JavaScript driver
var Gitana = require('gitana');
var repoId = 'someRepoId';
conn = Gitana.connect({
}, function(err) {
if (err) console.log(err);
});
conn.readRepository(repoId).then(function () {
console.log(this.title);
this.readBranch("master").then(function () {
this.createNode({
'_type': 'custom:genericContent',
'name': 'generic1',
'description': 'this is a node named generic1',
'pageId': ['all', 'page5'],
'placementId': ['all'],
'loginState': ['all'],
'geoCode': ['all'],
'content': 'Here is some test content'
});
})
});
{
"type": "object",
"properties": {
"name": {
"type": "string",
"title": "Name"
},
"description": {
"type": "string",
"title": "Description"
},
"placementId": {
"type": "array",
"items": {
"type": "string"
},
"title": "Placement ID"
},
"pageId": {
"type": "array",
"items": {
"type": "string"
},
"title": "Page ID"
},
"geoCode": {
"type": "array",
"items": {
"type": "string"
},
"title": "Geo Code"
},
"loginState": {
"type": "array",
"items": {
"type": "string"
},
"title": "Login State"
},
"content": {
"type": "string",
"title": "Content"
}
},
"title": "Generic Content",
"description": "Just a generic content type",
"_parent": "n:node"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment