I'm facing difficulty in implementing LinkedIN Share Api in Asp.net application . Can any one help me ?
I found the documentation for the LinkedIN Share API (https://developer.linkedin.com/documents/share-api).
It is saying that i should create a XML for sharing and should post this to the URL "http://api.linkedin.com/v1/people/~/shares"
I have two doubts after reading this document
- How to pass the tokens to the server along with the XML, it is not told in the documentation?
- What should be he name/key of the XML Content Posted?
Requirement is : I need to share an update ("just a text ) to a users linked in account. The text to share is given by the user through a text box(so it will only contain text)
I'm Using LinkedIn OAuth Library 0.6.1 For Authentication. Since i didn't find any method (that helps to post) in this library, i'm planning to use Share API directly. And Post to Linkedin by Using the class "HttpWebRequest"
What i did till now:
1.Created a app in linked in, so i got App-Key and App-Key 2.In order to Authenticate, redirects the user to linked in using the BeginAuthMethod in the OAuth Library 0.6.1 like this
var token = OAuthManager.Current.CreateToken(callback: this.AppRedirectUrl);
OAuthManager.Current.BeginAuth (token, endResponse: true, displayAllowDenyScreen: false);
3.After Authentication i receive the response from linked in and i use that auth-token to fetch the usertoken like this
var token = OAuthManager.Current.GetTokenInCallback();
var session = OAuthManager.Current.CompleteAuth(token);
this.UserToken = token.Token;
this.UserSecret = token.TokenSecret;
4.I have created a XML somewhat like this :
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<share>
<comment>83% of employers will use social media to hire: 78% LinkedIn, 55% Facebook, 45% Twitter [SF Biz Times] http://example.com</comment>
<content>
<title>Survey: Social networks top hiring tool - San Francisco Business Times</title>
</content>
<visibility>
<code>anyone</code>
</visibility>
</share>
5.So now i have the App-Key, App-Secret, User-Token and User-Secret , and i have the xml and the url to post (ie http://api.linkedin.com/v1/people/~/shares)
How to post this xml to the url using the tokens?. Can any one give some/any information regarding this?
I came across an example in java doing the same. the link is "https://developer.linkedin.com/documents/writing-linkedin-apis".But i need this in .NET
POST /v1/people/~/shares HTTP/1.1 Authorization: OAuth oauth_consumer_key="w_1233373R-J97_wH3_131231kL9netWMe90_OM1233gQzip-ssCmwKWyJU",oauth_signature_method="HMAC-SHA1",oauth_timestamp="11233865",oauth_nonce="20012339",oauth_version="1.0",oauth_token="5f3c5cf2-e661-41bd-1230-274312361",oauth_signature="Fdw6%2BJh2133123brPeZGY%3D" Host: api.linkedin.com Content-Length: 634 X-Forwarded-For: 10.203.10.109 X-Target-URI: http://api.linkedin.com Content-Type: application/xml Connection: Keep-Alive [Here Comes XML]- shajivkin which some of them i have with me they are OAuth oauth_consumer_key = [App Key], oauth_token = [Auth_tokn]Buti dont have some other keys like : oauth_signature, oauth_nonceāHow can i generate these keys? - shajivk