I am planning to translate the curl
API call below to node.js
though I am still getting an error
when doing a POST.
curl -X POST --user user1@customer1:secret http://demo.test.com/controller/actions/38 -F [email protected]
Below is initial code using the request - npm module, but the API call still fails.
var requestdata = fs.readFileSync('./ExportActions.json').toString();
var request = require('request');
request.post({
url: 'https://demo.test.com/controller/actions/38',
auth: {
'user': 'user1@customer1',
'pass': 'secret'
},
body: requestdata
}, function(error, response, body){
console.log(body);
});
I am getting the error below every time I run the script:
Could not import Actions: org.apache.commons.fileupload.FileUploadException: the request was rejected because no multipart boundary was found
Are there any workarounds when posting a JSON file using the npm request
module?
Thanks!
You can use Postman client to check this api instead of curl.