Last active
August 29, 2015 14:07
-
-
Save jpotts/2a7613be75681ce5b942 to your computer and use it in GitHub Desktop.
Creating content in Cloud CMS using the Gitana JavaScript driver
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | |
}); | |
}) | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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