Question

Hi guys i am getting this error repeatedly . Please help.

<?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>

Although i have sending the proper request but i am not able to sedn the mail. My code below :
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();
and also i have set as :
orequest.addHeader("Content-Type", "text/xml"); and
orequest.addPayload(xmlBody);
LINKEDIN_SERVICE.signRequest(accessToken, orequest);

but it is not helping. Can anyone help me on this.

Thanks

Was it helpful?

Solution

Hi guys i fixed this problem . please follow this http://developer.linkedin.com/thread/3255 my main reason/problem was my xml was not in the below format and scope was not enabled that is "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>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top