本文介绍了LinkedIn:为照片创建公司共享的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很想在Linkedin上创建公司照片共享.

I'm suffering to create a company photo share on Linkedin.

我看过几个线程,人们说,他们可以通过创建链接共享并传递"submitted-url"的图像URL来在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.考虑以下有效负载:```

E.G. Consider the following payload:```

{
    "visibility": { "code": "anyone" },
    "content": {
       "submitted-url": "localhost/image.jpg"
    }
}

```

就我而言,至少,该共享在LinkedIn上显示为链接共享.我还尝试了提供标题"等字段的组合,但是没有运气.

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.

接下来,我找到了以下文档:https://developer.linkedin.com/docs/guide/v2/shares/rich-media-shares#upload

Next, I've found the following documentation: https://developer.linkedin.com/docs/guide/v2/shares/rich-media-shares#upload

这似乎与 https://developer.linkedin.com/docs>,因此我不知道此文档是否仍然适用.

That does not seem to be linked from the https://developer.linkedin.com/docs, so I have no clue if this documentation still applies.

我尝试了以下端点:"https://api.linkedin.com/media/上传"和授权:承载..."标头,带有内容类型:应用程序/x-www-form-urlencoded",带有文件有效载荷,但响应为:

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.

我偶然从某些应用程序中知道,有一种方法可以通过API在LinkedIn上共享照片共享,但是我无法在描述该内容的地方找到正确的文档.

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 :)

如果LinkedIn上的某人可以添加适当的文档,那就太好了!

And if someone from LinkedIn could add the proper documentation, that would be superb!

谢谢!

推荐答案

LinkedIn提供了富媒体API 来进行图像共享.

LinkedIn provides rich media API to do an image share.

假设您已经具有访问令牌(access_token),您的组织ID为org_id,图像文件名为"flower.png"

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)下面的通话可帮助您使用上传媒体API将图片上传到LinkedIn.

1) Below call helps you to upload the image to LinkedIn using upload media API

curl -X POST \
  https://api.linkedin.com/media/upload \
  -H 'authorization: Bearer <access_token>’ \
  -H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
  -F fileupload=@flower.png

上面的调用返回以下响应格式:

The above call returns the below response format:

{
    "location": "<image_urn>"
}

2)现在使用上面的image_urn作为响应,您将能够使用下面的调用创建图像共享

2) Now using the above image_urn in response, you will be able to create an image share using the below call

在进行以下调用之前,请用原始值替换access_token,org_id和image_urn

Please replace access_token, org_id and image_urn with the original values before making the below call

curl -X POST \
  https://api.linkedin.com/v2/shares \
  -H 'authorization: Bearer <access_token>’ \
  -H 'content-type: application/json' \
  -d '{  "owner": "urn:li:company:<org_id>",
  "text": {
    "text": "test image attachemnt 0614"
  },
  "subject": "test image attachemnt 0614",
  "distribution": {
     "linkedInDistributionTarget": {}
  },
  "content":{
    "contentEntities": [
      {
         "entity": "<image_urn>"
      }
      ],
     "description": "content description1",
     "title": "Test Share with Image"
  }
}'

这篇关于LinkedIn:为照片创建公司共享的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-31 06:12