squiz
v0.1.1
Published
### A Node.js module for interacting with the Squiz Matrix CMS. ###
Downloads
3
Readme
node-squiz
A Node.js module for interacting with the Squiz Matrix CMS.
This module will allow core-level Squiz Matrix functions over the Simple Object Access Protocol (SOAP), allowing third-party applications to create, modify and retrieve content within the system. But its not just that, this module provides more tailored functions to suit specific needs which usually are a huge problem to get around. Everything has been designed in easy-to-use way, so you haven't got to be a Node.js expert.
Installation
Node.js
Install the NPM module and save it as a dependence in your package.json
:
npm install --save squiz
Now that's done, you'll be able to require this module in a Node script - let's create an app.js
file:
var squiz = require("squiz");
Having problems?: Make sure you have Node.js >= v.0.10 installed on your machine, use node -v
to find out.
Squiz
You will need to setup a SOAP Server if you haven't already got one to use. To add a SOAP Server, in the Add menu, go to Web Services -> SOAP Server. Once this is added, enable the SOAP Server and make sure it is Live (Also check permission levels).
Once the above is done, get the webpath for the SOAP Server and append ?WSDL to the end like so:
https://hostname/path/to/soap_server?WSDL
Great! The Soap Server now just needs to have some enabled services setup, choose from the below services and follow the instructions:
- Asset Service
- File Retrieval Service
- Search Service
- Workflow Service SOON
- Link Service SOON
- Metadata Service SOON
- Permission & Role Service SOON
Make sure everything is enabled, regenerate your WSDL and you are done!
Note: We are in early days and some of the above services may have missing functionality.
Usage
Connection
// Connection to the Squiz soap server
var soap = squiz({
// Your squiz host
host : "hostname",
// Path to your WDSL file
wdsl : "/path/to/soap_server?WSDL",
// Basic authentication
auth : "htpasswd",
// The asset id of the parent which will hold everything
parent: 1181394
});
You will then need to create a htpasswd
file consisting of your username and password, i.e username:password
.createAsset( file, options, [callback] )
Creates an asset
file: String
options: Array
soap.createAsset("my/precious.html", {
name: "different because im cool"
}, function(assetCreated) {
console.log(assetCreated);
});
.upload( file, assetId, [callback] )
Uploads a file to a specific asset.
file: String
assetId: Object
soap.upload("my/precious.html", {
id: 20000
}, function(assetUploaded) {
console.log(assetUploaded);
});
.batch( files, [callback] )
Inserts a batch of files into Squiz, regardless if the asset is currently present in Squiz or not.
files: Array
// Get these files into squiz!
soap.batch([{
"name": "myfile.txt"
}], function(response) {
console.log(response);
});