Base64 data not working while uploading an image on linkedin Upload URL [Linkedin-API-V2]

Viewed 152

We are trying to upload image data into uploadUrl, after registering the image on LinkedIn.

When we use ReadStream of image for uploading into the uploadUrl then it works fine, but when we tried to upload base64 image data directly then it is not working and it gives a Bad Request Error.

Request Data:

Working Request Data:

url : uploadUrl <from register upload response> 
data: ReadStream Object
headers: 
{
   "Content-Type":"image/jpg",
   "X-Restli-Protocol-Version":"2.0.0",
   "Authorization":"Bearer <access_token>"
}

Not Working Request Data:

url : uploadUrl <from register upload response> 
data: base64
headers: 
{
   "Content-Type":"image/jpg",
   "X-Restli-Protocol-Version":"2.0.0",
   "Authorization":"Bearer <access_token>",
   "Content-Transfer-Encoding":"base64"
}

Node Code for Both Request data:

await axios.put(url, data, { headers: headers});

So, Is only the Stream object supported for uploading image data to uploadUrl. When I tried to upload base64 data my timeline of LinkedIn Posts goes blank.

enter image description here

[Img 1.0 Timeline Goes Blank]

0 Answers
Related