When I am trying to upload an image using LinkedIn v2 API every time I get a 400 Bad request error.
Reference is taken from Here : Link
Steps I perform in postman:
Step 1: API: https://api.linkedin.com/v2/assets?action=registerUpload,
Request: POST,
Headers: Authorization: Bearer token, Content-Type: 'application/json', X-Restli-Protocol-Version: '2.0.0'
Request:
{
"registerUploadRequest":{
"owner":"urn:li:organization:724981XXX",
"recipes":[
"urn:li:digitalmediaRecipe:feedshare-image"
],
"serviceRelationships":[
{
"identifier":"urn:li:userGeneratedContent",
"relationshipType":"OWNER"
}
],
"supportedUploadMechanism":[
"SYNCHRONOUS_UPLOAD"
]
}
}
Response: Get uploadUrl
Step2:
End point: uploadURL<from step1's response>,
Request: PUT,
Headers: Authorization: Bearer token, Content-Type: 'image/jpeg', X-Restli-Protocol-Version: '2.0.0', media-type-family:'STILLIMAGE<from step1's response>'
Body: <base_64>
Response: 400 Bad Request
Via curl request working fine. What I am doing wrong?
Thanks in advance.
'Authorization': Bearer ${ access_token }
,
'X-Restli-Protocol-Version': '2.0.0',
'Content-Type': 'image/jpg'
body is simply the image file contents or a BLOB
method: POST - worked for me... for some PUT worked