I'm doing some integration with LinkedIn APIs using C# and the Hammock libray.
I'm stuck trying to use the messaging API... I get an error saying "Couldn't parse mailbox-item document: error: Unexpected end of file after null".
It seams that the POST content is going empty I don't know...
Here's my code:
RestClient client = new RestClient();
client.Authority = "http://api.linkedin.com/v1";
client.Credential开发者_运维百科s = credentials;
//client.Method = WebMethod.Post;
byte[] msg = Encoding.Default.GetBytes(doc.OuterXml);
client.AddPostContent(msg);
RestRequest request = new RestRequest();
request.Path = "/people/~/mailbox";
request.Method = WebMethod.Post;
//request.AddPostContent(msg);
RestResponse response = client.Request(request);
My xml (that goes in msg variable) is:
<?xml version="1.0" encoding="UTF-8"?>
<mailbox-item>
<recipients>
<recipient>
<person path="/people/~" />
</recipient>
</recipients>
<subject>teste</subject>
<body>teste</body>
</mailbox-item>
Thanks in advance.
In your code, the line that adds the POST content is commented out!
精彩评论