2015-02-24 52 views
0

是否可以使用panxapi上传文件?使用node.js上传文件(使用软件包panxapi)

例如,一个API调用需要文件上传来设置用户ip映射。

在这袅袅与

curl -form [email protected] "https://hostname/api/?type=user-id&action=set" 

我不确定如何添加这个作为一个参数使用panxapi我的API调用来完成。

继承人我的代码:

var panxapi = require('panxapi'); 

// Connect to the client 
var client = panxapi.createPanClient({ 
    host: 'hostname', 
    key: 'apikey', 
    protocol: 'https' 
}); 

var params = { 
    type: 'user-id', 
    action: 'set', 
} 

client.request(params, function(err, xml, etree) { 
    if (err) console.log(err); 
    console.log(xml); 
}) 

而卷曲的呼叫(工作)

curl --form [email protected] "https://hostname/api/?type=user-id&action=set&key=<key>" 

回答