pressgang-rest

A high level library for REST communication with a PressGang Component Content Management System (CCMS) Server

Usage no npm install needed!

<script type="module">
  import pressgangRest from 'https://cdn.skypack.dev/pressgang-rest';
</script>

README

pressgang-ccms-rest-node

A node module that provides a REST client library for the PressGang CCMS. It provides a more semantic interface for application development than the raw PressGang REST interface. Uses restler for the REST interface.

Installation

npm install pressgang-ccms-rest-node

Basic Usage

First, require pressgang-ccms-rest-node:

var PressGangCCMS = require('pressgang-ccms-rest-node').PressGangCCMS;

Next, create a new PressGangCCMS object:

var pressgang = new PressGangCCMS('http://127.0.0.1:8080/TopicIndex');

Now, you can get the XML of a topic:

pressgang.getTopicData('xml', 8445, 
    function(err, result){
        console.log('The topic xml content is:' + result);
    });

To get the JSON representation of a topic:

pressgang.getTopicData('json', 8445, 
    function(err, result){
        console.log('The JSON representation of the topic is:' 
        + JSON.Stringify(result);
    });

isContentSpec is an example of a more semantic interface to PressGang:

pressgang.isContentSpec(456, 
    function(err, is){
        if (is) console.log('Topic 456 is a Content Specification')
    });