Problems uploading images with “Share on LinkedIn”

白昼怎懂夜的黑 提交于 2019-12-13 03:47:04

问题


So I am trying to post an image to my personal page through the new v2 LinkedIn API. I am sending the following data:

{"author":"urn:li:person:MYID","lifecycleState":"PUBLISHED","visibility":{"com.linkedin.ugc.MemberNetworkVisibility":"PUBLIC"},"specificContent":{"com.linkedin.ugc.ShareContent":{"shareMediaCategory":"IMAGE","shareCommentary":{"text":"Hello. Just testing the LinkedIn API."},"media":[{"status":"READY","originalUrl":"https:\/\/www.bbc.co.uk\/news","title":{"text":"BBC news"},"description":{"text":"A test post about BBC news"},"media":"urn:li:digitalmediaAsset:C4E22AQFmydgog-wKTw"}]}}}

As you'll see I've already uploaded the image and have a successful Asset ID and reference.

I get a successful id back from Linkedin: urn:li:share:651159824176993XXX but for some reason my image never appears?? What am I doing wrong?


回答1:


Before creating the UGC post referencing the registered asset, you need to make sure that the asset is AVAILABLE, otherwise your image won't appear on LinkedIn.

When registering an asset, it goes through the following phases:

  1. PROCESSING (LinkedIn probably does some optimizations to the image / checks if it's valid)
  2. AVAILABLE (you should be good to go)
  3. CLIENT_ERROR (or some other error I can't remember. Basically you should try it with a different asset)

For my app, before creating the UGC post with the image(s), I make sure the asset(s) is / are AVAILABLE first. How do I do that? By checking the status of each asset every 5 seconds with a timeout of 5 minutes (I tried it with a GIF once and to this day is still processing haha).

Once all assets are AVAILABLE, I create the UGC post referencing them, just like you did in your question.



来源:https://stackoverflow.com/questions/55144091/problems-uploading-images-with-share-on-linkedin

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!