2015-12-28 71 views
0

我想分享linkedin上的帖子。分享到linkedin返回「無法解析JSON共享文檔」

我設法登錄並獲得返回idaccessToken但是當我遵循的sharing an update的REST API的方式,我不斷收到:

Error: failed [400] { 
    "errorCode": 0, 
    "message": "Can not parse JSON share document.\nRequest body:\n\nError:\nnull", 
    "requestId": "NWGE7D4LSW", 
    "status": 400, 
    "timestamp": 1451699447711 
} 

我的HTTP POST看起來是這樣的:

HTTP.post('https://api.linkedin.com/v1/people/~/shares?format=json&oauth2_access_token=' + accessToken, { 
      'headers': { 
       'Content-Type': "application/json", 
       'x-li-format': "json" 
      }, 
      'comment': "test!", 
      'visibility': { 
       'code': "anyone" 
      } 
      }); 

回答

0

這工作:

 HTTP.post('https://api.linkedin.com/v1/people/~/shares?format=json&oauth2_access_token=' + Meteor.user().services.linkedin.accessToken, { 
     headers: { 
      "Content-Type": "application/json", 
      "x-li-format": "json" 
     }, 
     data: { 
      comment: "testing", 
      visibility: { 
      code: "anyone" 
      } 
     } 
     });