2015-02-24 53 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>" 

回答