This SDK is a toolkit to access to Movable Type's DataAPI.
Some files generated by this product are parts of the Movable Type.
npm install git://github.com/movabletype/mt-data-api-sdk-js.git
or
npm install <downloaded tarball>
var MT = {
DataAPI: require("mt-data-api-sdk")
};
var api = new MT.DataAPI({
baseUrl: "http://example.com/mt/mt-data-api.cgi",
clientId: "node"
});
var credential = {
username: "USER_NAME",
password: "PASSWORD",
remember: true
};
// Session information will be stored to "$HOME/.mt-data-api.json" by default.
api.authenticate(credential, function(response) {
if (! response.error) {
api.listEntries(2, {status: "Draft"}, function(response) {
// Do stuff
});
}
});
Installation depends on node, npm, bower, and grunt-cli
To install node, see http://nodejs.org/ (If you are using Mac, you can install node via homebrew)
Then, you can install grunt-cli with npm like the following. When you have some error in installation, try sudo.
[sudo] npm install -g bower
[sudo] npm install -g grunt-cli
git clone git@github.com:movabletype/mt-data-api-sdk-js
, and move the directory you cloned, then execute the following command
make
make dev task generate scripts in lib and dist directory from src directory, and run the dependant tasks
make dev
make build task generate optimized scrips in dist directory
make build
make test task run tests with Node.js and PhantomJS.
make test
You can also run tests with MT's PSGI Server, if you had been sat up MT and PSGI environment.
MT_HOME=/path/to/mt make test
The MIT License (MIT)