I am following the LinkedIn documentations Here to upload a file as an octet stream to the LinkedIn Assets API, but I keep getting back an empty response
This is the curl example they gave
curl -v -H "Content-Type:application/octet-stream" --upload-file /Users/username/SampleVideo_2mb.mp4 'https://api.linkedin.com/mediaUpload/C5400AQHpR1ANqMWqNA/uploadedVideo/0?ca=vector_feedshare&cn=uploads_secure&ccn=ambry-video&m=AQLEZ2pjh43pagYYYXRaCyztOykwDzluHkkYTbsMjNUzivrEOeObw9h3&app=1234&sync=1&v=beta&ut=1KeEm4JnMnJpo1'
What is the proper axios equivalent of the above code?
Here is what I tried in NodeJS
let uploadHeaders = uploadRegisterData['uploadMechanism']['com.linkedin.digitalmedia.uploading.MediaUploadHttpRequest']['headers'];
let videoUploadFinaleResponse = await axios.put(uploadUrl, fs.createReadStream(fileName), {
headers: {
'Accept': '*/*',
...uploadHeaders,
'Content-Type': 'application/octet-stream'
}
});
let uploadedVideoData = videoUploadFinaleResponse.data; //This is always coming back as an empty string
The response data is always coming back as an empty string "".
I have a feeling my axios code equivalent is somehow wrong.
How can I get this right?
Thank you.