Is it possible to upload files using the panxapi?
For example an API call requires a file upload for setting a user-ip mapping.
In curl this done with
curl -form file=@myfile "https://hostname/api/?type=user-id&action=set"
I'm unsure how to add this as a parameter to my API call using panxapi.
Heres my code:
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);
})
And the curl call (that works)
curl --form file=@ipmapping "https://hostname/api/?type=user-id&action=set&key=<key>"
Aucun commentaire:
Enregistrer un commentaire