I’am using node.js to do the below bulk import:
var bodyFormData = new FormData();
bodyFormData.append('Content-Disposition', 'form-data');
bodyFormData.append('name', 'users');
bodyFormData.append('filename', filePath);
bodyFormData.append('Content-Type', 'text/json');
bodyFormData.append('connection_id', connection_ID);
const options = {
method: 'POST',
url: 'https://***.com/api/v2/jobs/users-imports',
headers: {
authorization: Bearer,
'content-type': 'multipart/form-data; boundary=---011000010111000001101001'
},
data: bodyFormData
};
axios.request(options).then(function (response) {
console.log('status', response.data.data.status);
}).catch(function (error) {
console.error(error);
});
And I’m keep having the below error:
Error 400 => ‘Invalid multipart payload format’
I also try this way:
const options = {
method: 'POST',
url: 'https://***/api/v2/jobs/users-imports',
headers: {
'authorization': BEARER,
'content-type': 'multipart/form-data; boundary=---011000010111000001101001'
},
data: '-----011000010111000001101001\r\nContent-Disposition: form-data; name="users"; filename="'+filePath+'"\r\nContent-Type: text/json\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name="connection_id"\r\n\r\n'+connection_ID+'\r\n-----011000010111000001101001\r\nContent-Disposition: form-data;'
};
But i go the same error Error 400 => ‘Invalid multipart payload format’