I'm suffering to create a company photo share on Linkedin.
I've seen several threads, where people say, they could create a photo share on LinkedIn by creating a link share, passing the image URL for the "submitted-url".
E.G. Consider the following payload: ```
{
"visibility": { "code": "anyone" },
"content": {
"submitted-url": "localhost/image.jpg"
}
}
```
In my case, at least, the share appears as a link share on LinkedIn. I've also tried the combinations of providing the "title" etc. fields, but no luck.
Next, I've found the following documentation: https://developer.linkedin.com/docs/guide/v2/shares/rich-media-shares#upload
That does not seem to be linked from the https://developer.linkedin.com/docs, so I have no clue if this documentation still applies.
I've tried the following endpoint: "https://api.linkedin.com/media/upload" with the "Content-Type: application/x-www-form-urlencoded" and "Authorization: Bearer ..." -headers, with file payload but the response is:
```
{
"serviceErrorCode": 100,
"message": "Not enough permissions to access media resource",
"status": 403
}
``
It does not matter, what permissions I have set for my app.
I happen to know from some applications, there is a way to share photo shares on LinkedIn via the API, but I don't manage to find the correct documentation where this is described.
If you know a way that worked for you but isn't already listed here, please inform me and all the others suffering from this problem :)
And if someone from LinkedIn could add the proper documentation, that would be superb!
Thanks!
Meanwhile, our application got accepted to LinkedIn "marketing partner" program which gives you access to LinkedIn API V2, the documentation is publicly available, but you need to manually apply for it. They may or may not accept your application.
Just couple gotchas for the next person who may struggle with this or some other issues we encountered.
Once our application got accepted to the "marketing partner"-program, we started to receive strange errors for our LinkedIn v1 API calls, namely "410 Gone" - "This resource is no longer available under v1 APIs".
All the calls using the application that got the permissions to API v2 were failing to this error. There was no way to use the old API with that application any longer.
The email confirming our application's acceptance to the program was sent to us in one day delay from when these problems started. Strange way to deal API switch, but luckily we have access to API v2 now.
LinkedIn API v2 gives you the possibility to upload and publish photo shares (one or many photos), which isn't possible with API v1.
The error we received for every call to API v1 after the acceptance:
{ "status": 410, "message": "This resource is no longer available under v1 APIs", "errorCode": 0, "requestId": "removed", "timestamp": 1522333590761 }
LinkedIn provides rich media API to do an image share.
Lets assume you already have an access token (access_token), your organization id is org_id and the image file name is "flower.png"
1) Below call helps you to upload the image to LinkedIn using upload media API
The above call returns the below response format:
2) Now using the above image_urn in response, you will be able to create an image share using the below call
Please replace access_token, org_id and image_urn with the original values before making the below call