API为r_basicprofile调用#LinkedIn [英] API calls #LinkedIn for r_basicprofile

查看:49
本文介绍了API为r_basicprofile调用#LinkedIn的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经仔细阅读了有关API调用的LinkedIn开发人员文档,在这些文档之后,我能够请求访问代码,与服务器进行交换并设法获得访问令牌.

I have read carefully the LinkedIn developer documents regarding API calls, following the documents, I was able to request the access code, exchange it with server and manage to get access token.

此后,我设法通过以下代码使用json格式的访问令牌来获取一些成员的个人资料.

After that I managed to get some of the member's profile, using the access token in json format with the below code.

$api_url = 'https://api.linkedin.com/v1/people/~:(id,first-name,last-name,email-address)?format=json';
$context = stream_context_create(array(
    'http' => array(
        'header' => "Authorization: Bearer " . $accessToken
    ),
));

$result = file_get_contents($api_url, false, $context);
echo $result;

无论如何,问题是:尝试进行任何不同的调用都将失败,尽管它们是根据LinkedIn的文档进行的,并且允许它们用于r_basicprofile,但仍然存在错误:

however the issue is: trying to conduct any different calls will fail, although they are as per the documents of LinkedIn and they are allowed for the r_basicprofile, but yet the error:

警告:file_get_contents( https://api.linkedin.com/v2/people/〜:(industryId〜)?format = json ):无法打开流:HTTP请求失败!HTTP/1.0 403禁止

Warning: file_get_contents(https://api.linkedin.com/v2/people/~:(industryId~)?format=json): failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden

我尝试了以下一些方法,但是没有正确的方法

I tried some of the following but nothing goes right

$api_url = 'https://api.linkedin.com/v2/me';
$context = stream_context_create(array(
    'http' => array(
        'header' => "Authorization: Bearer " . $accessToken
    ),
));

$result = file_get_contents($api_url, false, $context);
echo $result;

我什至尝试通过以下GET请求获取memeber的个人资料,但返回了相同的403.

I even tried to get memeber's profile with the below GET requests, but same 403 returned.

>://://api.linkedin.com/v2/people/(id :{个人ID})

>://://api.linkedin.com/v2/people/(id :{profileID})?projection =(id,firstName,lastName,industryId〜)

https://api.linkedin.com/v2/people/(id:{profileID})?projection=(id,firstName,lastName,industryId~)

很高兴了解如何拨打电话以及出了什么问题.

Would appreciate to understand how to make those calls, and what is wrong.

推荐答案

问题是V2 api要求您与linkedin建立伙伴关系.这意味着您会收到 403 禁止错误.

the problem is that the V2 api requires you to get a partnership with linkedin. this means you get the 403 forbidden error.

与LinkedIn的合作为您提供了其他API功能和数据访问,通话限制增加和专用支持.阅读有关我们的各种合作伙伴计划和用例的更多信息并查看是否适合您的应用.只接受申请当我们认为他们正在为成员,开发人员和领英.

Partnering with LinkedIn provides you with additional API functionality & data access, increased call limits & dedicated support. Read more about our various Partner Programs and use cases and see if one is a match for your app. Applications are only accepted when we feel that they're providing value to members, developers and LinkedIn.

来源: https://developer.linkedin.com/partner-程序

很高兴为您提供所需的api的V1版本.

fortunatly for you there is a V1 version of the api you require.

https://api.linkedin.com/v1/people/{ID}?format=json

这篇关于API为r_basicprofile调用#LinkedIn的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆