大家好我反复得到这个错误。请帮忙。
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<error>
<status>403</status>
<timestamp>1380768861652</timestamp>
<request-id>QDGIGCTHXW</request-id>
<error-code>0</error-code>
<message>Access to posting messages denied.</message>
</error>
虽然我发送了正确的请求,但我无法发送邮件。
我的代码如下:
String linkedinurl = "http://api.linkedin.com/v1/people/~/mailbox";
我也设置为:
OAuthRequest orequest = new OAuthRequest(Verb.POST, linkedinurl);
OAuthService LINKEDIN_SERVICE = new ServiceBuilder()
.provider(LinkedInApi.class).apiKey(LINKEDIN_APP_ID)
.apiSecret(LINKEDIN_APP_SECRET).scope("w_messages").build();
orequest.addHeader("Content-Type", "text/xml"); and
orequest.addPayload(xmlBody);
LINKEDIN_SERVICE.signRequest(accessToken, orequest);
但它没有帮助。任何人都可以帮助我。
由于
答案 0 :(得分:2)
大家好我修复了这个问题。请关注此http://developer.linkedin.com/thread/3255 我的主要原因/问题是我的xml不是以下格式,并且未启用范围“w_message”。
<?xml version='1.0' encoding='UTF-8'?>
<mailbox-item>
<recipients>
<recipient>
<person path="/people/id=T4sKMZ8qEN" />
</recipient>
</recipients>
<subject>Invitation to Connect</subject>
<body>Please join my professional network on LinkedIn.</body>
<item-content>
<invitation-request>
<connect-type>friend</connect-type>
<authorization>
<name>NAME_SEARCH</name>
<value>1Mlb</value>
</authorization>
</invitation-request>
</item-content>
</mailbox-item>