是否可以使用panxapi上传文件?
例如,API调用需要文件上传来设置user-ip mapping。
用curl完成这个
curl -form file=@myfile "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 file=@ipmapping "https://hostname/api/?type=user-id&action=set&key=<key>"