0.2.1 • Published 11 years ago

trac-jsonrpc-client v0.2.1

Weekly downloads
10
License
-
Repository
github
Last release
11 years ago

trac-jsonrpc-client

nodejs client for the Trac JSON RPC api.

introduction

Provide simple client to interact with a Trac server via JSONRPC. XmlRpcPlugin must be enabled on server.

synopsis

Simple low-level call using callRpc :

  var jsonrpc = require('trac-jsonrpc-client');
  var client = jsonrpc('http://trac-host/trac/env/login/rpc');

  cli.callRpc('system.getAPIVersion',[],function(err, data, result){
    if(err){
      console.log(err);
    } else{
      console.log('Server JSON RPC API version is ' + result.join('.'));
    }
  });

Using proxy client :

  var jsonrpc = require('../json-rpc');
  var cli = new jsonrpc('http://trac-host/trac/env/login/rpc');
  cli.proxy(function(err, p){
    // proxy is ready
    p.system.getAPIVersion(function(err, data, result){
      if(err){
        console.log(err);
      } else{
        console.log('Server JSON RPC API version is ' + result.join('.'));
      }
    });
  });

If authentification is required you need to specify a username and password :

  var jsonrpc = require('../json-rpc');
  var cli = new jsonrpc('http://trac-host/trac/env/login/rpc', {
    auth:{username:'tracuser',password:'hehehe'}
  });