【发布时间】:2022-07-06 19:38:46
【问题描述】:
我在使用 LinkedIn Rest API 时遇到错误。我尝试在我的公司页面上发布。我面临错误。当我在我的 LinkedIn 个人资料上发帖时。那也行。但是在公司页面我显示一个错误。
错误
{
"serviceErrorCode": 100,
"message": "Field Value validation failed in REQUEST_BODY: Data Processing Exception while processing fields [/owner]",
"status": 403
}
详情
我使用共享 API,API URL https://api.linkedin.com/v2/shares。我的错误与 "owner": "urn: li: organization:76615898" 有关。我通过了,我的公司页面https://www.linkedin.com/company/76615898/。
{
"content": {
"contentEntities": [
{
"entityLocation": "https://officialrajdeepsingh.dev/how-to-create-web-stories-on-ghost-cms/",
"thumbnails": [
{
"resolvedUrl": "https://officialrajdeepsingh.dev/content/images/size/w2000/2022/02/Amp-ghost-cms--configation.png"
}
]
}
],
"title": "How to create web stories on Ghost CMS",
"description": "The google web story helps websites to grow very fast. We enable AMP web stories on your website for free in the post."
},
"distribution": {
"linkedInDistributionTarget": {}
},
"owner": "urn:li:organization:76615898",
"subject": "The google web story helps websites to grow very fast. We enable AMP web stories on your website for free in the post.",
"text": {
"text": "How to create web stories on Ghost CMS"
}
}
步骤
-
获取代码
-
获取访问令牌
获取代码
我使用get方法创建成功的代码。
GET https://www.linkedin.com/oauth/v2/authorization?
response_type=code&client_id=77d*******oo56&redirect_uri=https://officialrajdeepsingh.dev&state=testfoobar&scope=r_liteprofile%2520r_emailaddress%2520w_member_social
获取访问令牌
我使用post命令成功获取访问令牌
POST https://www.linkedin.com/oauth/v2/accessToken HTTP/1.1
Content-Type: application/x-www-form-urlencoded
grant_type=authorization_code
code=code-here
redirect_uri=https://officialrajdeepsingh.dev
client_id=77d*********56
client_secret=ma***********Ch
基于令牌,我尝试在我的 LinkedIn 页面上创建一个帖子。
权限
-
OAuth 2.0 范围
-
产品
OAuth 2.0 范围
对于权限,我添加了 3 个权限,以在 LinkedIn 页面上创建帖子。
产品
我不知道,代码中发生了什么。我还使用 ugcPosts 端点在我的公司页面上分享帖子。但不工作。 https://api.linkedin.com/v2/ugcPosts 使用 ugcPosts,我也面临错误
{
"serviceErrorCode": 100,
"message": "Field Value validation failed in REQUEST_BODY: Data Processing Exception while processing fields [/author]",
"status": 403
}
请告诉我如何解决分享https://api.linkedin.com/v2/shares点的错误以及如何解决。
【问题讨论】:
标签: rest linkedin linkedin-api