问题描述
尝试列出组织的所有UGC帖子时出现服务器错误.
I'm getting a server error when trying to list all UGC posts for an organization.
我在那儿遵循了API文档: https://docs.microsoft.com/zh-CN/linkedin/marketing/integrations/community-management/shares/ugc-post-api#find-ugc作者的帖子
I have followed the API documentation there: https://docs.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/ugc-post-api#find-ugc-posts-by-authors
我正在对此URL进行GET请求: https://api.linkedin.com/v2/ugcPosts?q=authors&authors=List(urn%3Ali%3Aorganization%3A6645672)
I'm doing a GET request on this URL: https://api.linkedin.com/v2/ugcPosts?q=authors&authors=List(urn%3Ali%3Aorganization%3A6645672)
我添加了具有正确值的Authorization标头.
I added the Authorization header with the correct value.
应该返回UGC帖子,但是我得到了以下API响应:
The UGC posts should be returned, but instead I'm getting the following API response:
{
'serviceErrorCode': 0,
'message': 'java.lang.ClassCastException',
'status': 500
}
这是响应头:
{
'X-LI-ResponseOrigin': 'RGW',
'X-Restli-Gateway-Error': 'true',
'Content-Type': 'application/json',
'Content-Length': '76',
'X-Li-Fabric': 'prod-lor1',
'Connection': 'keep-alive',
'X-Li-Pop': 'prod-efr5',
'X-LI-Proto': 'http/1.1',
'X-LI-UUID': 'lsI6Y1fvpRUgJP1JhSsAAA==',
'Set-Cookie': 'lidc="b=OB36:g=1813:u=339:i=1559916004:t=1559978523:s=AQE_uyAgsS2aohUoPQqxLGIDiYC9Gpfr"',
'X-LI-Route-Key': '"b=OB36:g=1813:u=339:i=1559916004:t=1559978523:s=AQE_uyAgsS2aohUoPQqxLGIDiYC9Gpfr"'
}
出于隐私方面的考虑,我没有为您提供访问令牌,但是您的团队将在我上面粘贴的响应标头中显示所有详细信息以及请求ID.
For privacy reasons I'm not giving you the Access Token, but your team will have all the details with the request ID present in the response headers I just pasted above.
感谢社区或LinkedIn支持团队帮助我调试此错误.
Thanks to the community or LinkedIn support team to help me debugging this error.
最诚挚的问候.
推荐答案
如您所指文档的注释中所述:
As described in the note of the doc you refer:
您应该在请求中添加标头,例如,以下请求运行正常:
You should add the header in the request, as example, the following request went fine:
curl -H "X-Restli-Protocol-Version: 2.0.0" "https://api.linkedin.com/v2/ugcPosts?q=authors&authors=List(urn%3Ali%3Aorganization%3A6645672)&oauth2_access_token=<a-valid-token>
希望对您有帮助
这篇关于LinkedIn API:列出UGC帖子时出现服务器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!