Quantcast
Channel: Spring Community Forums - Social
Viewing all articles
Browse latest Browse all 145

Spring.Social WP8 C#

$
0
0
Hi.

I'm having one problem that I can't resolve.

I want to create new share (I think that's the correct word linkedin is using) on linkedin social network (this is the link to do that on the console: http://api.linkedin.com/v1/people/~/shares). I'm using .NET/C# language on Windows Phone 8 platform. Authetication and getting some profile data works great, but there is a problem when I try to do some POST. What is the correct rest operation to do that and how do I format XML object? Obiously the input XML file is the problem, but I can't figure out why.

This is my sample code:

Spring.Http.HttpEntity entity = new Spring.Http.HttpEntity(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?><share><comment>Check out the LinkedIn Share API!</comment><visibility><code>anyone</code></visibility></share>");
entity.Headers.Add("Content-Type", "application/xml");
ILinkedIn linkedInClient = Classes.LinkedIn.Service.GetApi(Classes.LinkedIn.A uthToken, Classes.LinkedIn.AuthSecret);

linkedInClient.RestOperations.PostForObjectAsync<s tring>("/v1/people/~/share", entity, response =>
{
if (response.Error == null)
{
}
});

Classes.LinkedIn.Service.GetApi() method always gets the correct linked client (that's my method for doing that).

This is the error message I get:

POST request for 'https://api.linkedin.com/v1/people/~/share' resulted in 400 - BadRequest (Bad Request).

This is the stack trace if you need it:

at Spring.Rest.Client.Support.DefaultResponseErrorHan dler.HandleError(Uri requestUri, HttpMethod requestMethod, HttpResponseMessage`1 response)
at Spring.Rest.Client.Support.DefaultResponseErrorHan dler.HandleError(Uri requestUri, HttpMethod requestMethod, IClientHttpResponse response)
at Spring.Rest.Client.RestTemplate.HandleResponseErro r(Uri uri, HttpMethod method, IClientHttpResponse response, IResponseErrorHandler errorHandler)
at Spring.Rest.Client.RestTemplate.ResponseReceivedCa llback[T](ClientHttpRequestCompletedEventArgs responseReceived)

Maybe I'm using wrong post method. Or maybe entity object is wrong.

If you need more information please let me know.

Thanks,
Slobodan.

Viewing all articles
Browse latest Browse all 145

Trending Articles