Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
546 views
in Technique[技术] by (71.8m points)

Creating Image Share works fine on company page but I receive 500 Internal Server Error for personal page in LinkedIn

According to LInkedIn API docs, I was creating Image Share in 3 steps:

  1. I successfully registered my image to be uploaded. The response contained uploadUrl and asset id
  2. I successfully uploaded a picture. I made sure it had AVAILABLE status by sending request GET https://api.linkedin.com/v2/assets/C5622AQE1VHX1sCfgxA
  3. But when I tried to create a share with this image, I received 500 Internal Server Error response. That was my request:

POST https://api.linkedin.com/v2/ugcPosts

{
    "author": "urn:li:person:RRN_AC88I8",
    "lifecycleState": "PUBLISHED",
    "specificContent": {
        "com.linkedin.ugc.ShareContent": {
            "shareCommentary": {
                "text": "test"
            },
            "shareMediaCategory": "IMAGE",
            "media": [
                {
                    "status": "READY",
                    "description": {
                        "text": "test"
                    },
                    "media": "urn:li:digitalmediaAsset:C5622AQE1VHX1sCfgxA",
                    "title": {
                        "text": "test"
                    }
                }
            ]
        }
    },
    "visibility": {
        "com.linkedin.ugc.MemberNetworkVisibility": "PUBLIC"
    }
}

I also added headers:

X-Restli-Protocol-Version: 2.0.0
Content-Type: application/json
Authorization: Bearer ****

I've been granted w_member_social permission.

It's worth noting if I create Image Share on the Company page in the same way, it works fine (I respectively change 'author', 'media' fields and access token in the header).

Also, it works fine on the personal page if I remove the 'media' field from JSON and set: "shareMediaCategory": "NONE"

Then why doesn't it work out for creating Image Share on a personal (profile) page?

question from:https://stackoverflow.com/questions/65713755/creating-image-share-works-fine-on-company-page-but-i-receive-500-internal-serve

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...