0

我想做的是从名为data的函数命名的 LinkedIn API 中获取返回的数据getProfileData。如何访问包含信息的数据,例如firstNameand lastNamebut ingetProfileData而不仅仅是 function 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>
4

1 回答 1

0

您必须修复代码中的某些内容:

IN.API.Raw("/people/~:(id,first-name,last-name,location,positions)?format=json").result(onSuccess).error(onError);
于 2015-10-30T03:47:32.313 回答