Im using Linkedin Rest Api on a site im building, in general works great the only problem is that i cant send messages to my connections.
({'status': '400',
'content-length': '302',
'transfer-encoding': 'chunked',
'vary': '*',
'server': 'Apache-Coyote/1.1',
'-content-encoding': 'gzip',
'date': 'Wed, 28 Mar 2012 22:52:35 GMT',
'x-li-request-id': 'QU0G42N6TV',
'nncoection': 'close',
'x-li-format': 'xml',
'content-type': 'text/xml;charset=UTF-8'},
'<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
\n<error>\n <status>400</status>
<timestamp>1332975155652</timestamp>
<request-id>QU0G42N6TV</request-id>
<error-code>0</error-code>
<message>Couldn\'t parse mailbox-item document: error: Unexpected end of file after null</message>\n</error>\n'
this how i call the api:
client.request(url,’POST’,’text/xml’,param)
where:
url = 'http://api.linkedin.com/v1/people/~/mailbox'
param:
<?xml version='1.0' encoding='UTF-8'?><mailbox-item>
<recipients>
<recipient>
<person path='/people/TquMAMeCCD' />
</recipient>
</recipients>
<subject>Congratulations on your new position.</subject>
<body>Youre certainly the best person for the job!</body> </mailbox-item>
Thanks!
My Problem was finally on the header, i wasn’t setting the right content-type. That fixed it.