【问题标题】:Getting at LinkedIn returned data from Javascript SDK从 Javascript SDK 获取 LinkedIn 返回的数据
【发布时间】:2015-10-30 11:47:32
【问题描述】:

我想做的是从名为data 的LinkedIn API 中从名为getProfileData 的函数中获取返回的数据。如何访问包含firstNamelastName 等信息但在getProfileData 而不仅仅是在函数onSuccess 中的数据?

<script type="text/javascript" src="//platform.linkedin.com/in.js">
    api_key: YOUR_API_KEY_HERE
    authorize: true
    onLoad: onLinkedInLoad
</script>

<script type="text/javascript">

    // Setup an event listener to make an API call once auth is complete
    function onLinkedInLoad() {
        IN.Event.on(IN, "auth", getProfileData);
    }

    // Handle the successful return from the API call
    function onSuccess(data) {
        console.log(data);
    }

    // Handle an error response from the API call
    function onError(error) {
        console.log(error);
    }

    // Use the API call wrapper to request the member's basic profile data
    function getProfileData() {
        IN.API.Raw("/people/~").result(onSuccess).error(onError);
        // I want to see the profile data in here. 

    }

</script>

【问题讨论】:

    标签: javascript linkedin-api linkedin-jsapi


    【解决方案1】:

    你必须在你的代码中修复一些东西:

    IN.API.Raw("/people/~:(id,first-name,last-name,location,positions)?format=json").result(onSuccess).error(onError);
    

    【讨论】:

    • data.firstName, data.lastName in onSuccess 函数
    猜你喜欢
    • 2016-10-06
    • 1970-01-01
    • 1970-01-01
    • 2017-05-04
    • 2015-10-11
    • 2012-07-18
    • 1970-01-01
    • 2020-04-06
    • 2016-01-07
    相关资源
    最近更新 更多