Javascript 我可以在Node.js中使用剪纸(XML-RPC)API吗?

Javascript 我可以在Node.js中使用剪纸(XML-RPC)API吗?,javascript,node.js,api,xml-rpc,papercut,Javascript,Node.js,Api,Xml Rpc,Papercut,我打算使用PaperCut API,但据我判断,XML-RPC不支持Node.JS,或者我找不到合适的客户端。以下是与剪纸API的链接: 我想知道是谁能让它在JavaScript中工作。我在QNAP(集装箱站)中使用Node.js。如果可以在Python中运行,我应该安装Python容器吗?我可以使用Python中的一段代码从Node.js请求它吗?我为剪纸软件工作 很抱歉,我花了这么长时间才回复这个问题,但我终于找到了一个空闲的下午来编写一些代码 var xmlrpc = require('

我打算使用PaperCut API,但据我判断,XML-RPC不支持Node.JS,或者我找不到合适的客户端。以下是与剪纸API的链接:


我想知道是谁能让它在JavaScript中工作。我在QNAP(集装箱站)中使用Node.js。如果可以在Python中运行,我应该安装Python容器吗?我可以使用Python中的一段代码从Node.js请求它吗?

我为剪纸软件工作

很抱歉,我花了这么长时间才回复这个问题,但我终于找到了一个空闲的下午来编写一些代码

var xmlrpc = require('xmlrpc')

const authToken = 'token'

const hostAddress = "172.24.96.1"
 
// Waits briefly to give the XML-RPC server time to start up and start
// listening
setTimeout(function () {
  // Creates an XML-RPC client. Passes the host information on where to
  // make the XML-RPC calls.
  var client = xmlrpc.createClient({ host: hostAddress, port: 9191, path: '/rpc/api/xmlrpc'})
 
  // Sends a method call to the PaperCut MF/NG server

  client.methodCall(`api.${process.argv[2]}`, [authToken].concat(process.argv.slice(3)), function (error, value) {
    // Results of the method response
    if (undefined === error || null === error) {
        console.log(`Method response for \'${process.argv[2]}\': ${value}`)
    }
    else
    {
        console.log(`Error response for \'${process.argv[2]}\': ${error}`)
    }
  })
 
}, 1000)
要从命令行运行此命令,请尝试以下操作

node main.js getUserProperty alec balance

不要把标签放在问题的标题上。写一个合适的标题。假设你在问一位同事这个问题。你会问他们“PAPERCUT API | XML-RPC | NODE.JS”吗?我试图总结一下我认为标题中的问题。关于这个问题,我假设XML-RPC是否“支持”Node是非sequeuituur-XML-RPC是XML,因此可以在任何可以读/写XML的语言中使用。您提供的链接表示支持Python,但如果您更愿意使用JavaScript/Node,我会确保该语言有一个XML-RPC库,还有一些npm剪纸包装