0

リンクインから連絡先をインポートし、私が使用したphpを使用してメッセージを送信する方法

api_key: 'APIKEY'
authorize: true
credentials_cookie: true

 window.onload = function onLinkedInAuth() {
     // After they've signed-in, print a form to enable keyword searching
     var div = document.getElementById("sendMessageForm");

    div.innerHTML = '<h2>Send a Message To Yourself</h2>';
     div.innerHTML += '<form action="javascript:SendMessage();">' +
                  '<input id="message" size="30" value="You are awesome!" type="text">' +
                  '<input type="submit" value="Send Message!" /></form>';
 };

 function SendMessage(keywords) {
     // Call the Message sending API with the viewer's message
     // On success, call displayMessageSent(); On failure, do nothing.

     var message = document.getElementById('message').value; 
     var BODY = {
        "recipients": {
           "values": [{
             "person": {
                "_path": "/people/~",
             }
           }]
         },
       "subject": "JSON POST from JSAPI",
       "body": message
     }

     IN.API.Raw("/people/~/connections")
           .method("POST")
           /*.body(JSON.stringify(BODY)) */
           .result(displayMessageSent)
           .error(function error(e) { console.log(e);alert ("No dice"); });
 }

 function displayMessageSent() {
     var div = document.getElementById("sendMessageResult");
      div.innerHTML += "Yay!";
 }

URL http://developer.linkedin.com/documents/sample-code-sending-messageから参照

しかし、成功しませんでした..どんな助けでも大歓迎です!

4

1 に答える 1