アップデート....
これはJS APIで可能ですか?
JSAPI のさまざまなメソッドについては、こちらを参照してください。https://developer.linkedin.com/documents/inapiraw
以下のスクリプトを試しましたが、うまくいきませんでした。
var grp = {
"group-membership": {
"group": {
"id": 11234555
},
"show-group-logo-in-profile": true,
"email-digest-frequency": {
"code": "daily"
},
"email-announcements-from-managers": true,
"allow-messages-from-members": true,
"email-for-every-new-post": false,
"membership-state": {
"code": "member"
}
}
}
IN.API.Raw('/people/~/group-memberships').method('POST').body(JSON.stringify(grp)).result(function(a){
console.log(a);
});
応答:
{
"errorCode": 0,
"message": "Invalid xml {Expected elements 'group@http://api.linkedin.com/v1 membership-state@http://api.linkedin.com/v1 contact-email@http://api.linkedin.com/v1 show-group-logo-in-profile@http://api.linkedin.com/v1 allow-messages-from-members@http://api.linkedin.com/v1 email-digest-frequency@http://api.linkedin.com/v1 email-announcements-from-managers@http://api.linkedin.com/v1 email-for-every-new-post@http://api.linkedin.com/v1' instead of 'group-membership@http://api.linkedin.com/v1' here in element group-membership@http://api.linkedin.com/v1}",
"requestId": "5FX3EI2PEU",
"status": 400,
"timestamp": 1395909893090
}
XML の使用
xmlbody = '<?xml version="1.0" encoding="UTF-8"?> <group-membership> <group>
<id>G11234555</id> </group> <show-group-logo-in-profile>true</show-group-logo-in-profile> <email-digest-frequency>
<code>daily</code> </email-digest-frequency> <email-announcements-from-managers>true</email-announcements-from-managers> <allow-messages-from-members>true</allow-messages-from-members> <email-for-every-new-post>false</email-for-every-new-post> <membership-state>
<code>member</code> </membership-state> </group-membership> ';
IN.API.Raw('/people/~/group-memberships').method('POST').body(xmlbody).result(function(a){ console.log(a); });
応答:
{ "errorCode": 0, "message": "Json 本体を解析できませんでした: 予期しない文字 ('<' (コード 60)): 有効な値が必要です (数値、文字列、配列、オブジェクト、'true'、'false ' or 'null')\n at [Source: java.io.StringReader@27418295; line: 1, column: 2]", "requestId": "JFGI4LRP2C", "status": 400, "timestamp": 1395970257979 }