public APIWebRequest ( string method, string url, string postData ) : string | ||
method | string | WebRequestWithPut |
url | string | |
postData | string | |
return | string |
public string LinkedInAuth() { string email = ""; try { oAuthLinkedIn _oauth = new oAuthLinkedIn(); string oauth_token = Request.QueryString["oauth_token"]; string oauth_verifier = Request.QueryString["oauth_verifier"]; if (oauth_token != null && oauth_verifier != null) { Application["oauth_token"] = oauth_token; Application["oauth_verifier"] = oauth_verifier; _oauth.Token = oauth_token; _oauth.TokenSecret = Application["reuqestTokenSecret"].ToString(); _oauth.Verifier = oauth_verifier; _oauth.AccessTokenGet(oauth_token); string emailResponse = _oauth.APIWebRequest("GET", "https://api.linkedin.com/v1/people/~/email-address", null); email = ParselinkedInXMl(emailResponse, "<email-address>", "</email-address>"); string nameResponse = _oauth.APIWebRequest("GET", "https://api.linkedin.com/v1/people/~", null); FirstName = ParselinkedInXMl(nameResponse, "<first-name>", "</first-name>"); LastName = ParselinkedInXMl(nameResponse, "<last-name>", "</last-name>"); lblAlertMsg.Text = email + " sucessfully Login with LinkedIn" + FirstName + " " + LastName; Session.Remove(SessionKeys.ServiceProvider); } } catch (Exception ex) { ProcessException(ex); } return(email); }
protected void Page_Load(object sender, EventArgs e) { gettoken = Session["Session_OToken"].ToString(); getotokensecret = Session["Session_OTokenSecret"].ToString(); getverifier = Request.QueryString["oauth_verifier"]; //Get Access Token _oauth.Token = gettoken; _oauth.TokenSecret = getotokensecret; _oauth.Verifier = getverifier; _oauth.AccessTokenGet(gettoken); accessToken = _oauth.Token; accessTokenSecret = _oauth.TokenSecret; _oauth.Token = accessToken; _oauth.TokenSecret = accessTokenSecret; _oauth.Verifier = getverifier; //Display profile string response = _oauth.APIWebRequest("GET", "https://api.linkedin.com/v1/people/~/", null); //txtApiResponse.Text = response; XmlDocument xml = new XmlDocument(); xml.LoadXml(response); // suppose that myXmlString contains "<Names>...</Names>" XmlNodeList xnList = xml.SelectNodes("/person"); foreach (XmlNode xn in xnList) { string firstName = xn["first-name"].InnerText; string lastName = xn["last-name"].InnerText; string CompanyName = xn["headline"].InnerText; txtFirstName.Text = firstName; txtLastName.Text = lastName; //lblCompanyName.Text = CompanyName; } XmlNodeList xnList1 = xml.SelectNodes("/"); string response2 = _oauth.APIWebRequest("GET", "https://api.linkedin.com/v1/people/~/email-address", null); xml.LoadXml(response2); foreach (XmlNode Xnn in xnList1) { string emailAddress = Xnn["email-address"].InnerText; txtEmailID.Text = emailAddress; } }
protected void btnSendStatusUpdate_Click(object sender, EventArgs e) { UTF8Encoding utf8 = new UTF8Encoding(); string xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; xml += "<current-status>It's really working .</current-status>"; _oauth.Token = ConfigHelper.GetConfigValue("LiApiKey"); _oauth.TokenSecret = ConfigHelper.GetConfigValue("LiSecretKey"); _oauth.Verifier = txtoAuth_verifier.Text; string thumbprint = ConfigHelper.GetConfigValue("SigningCert"); X509Certificate2 localCert = LoadCertificateFromStoreByThumb(thumbprint); if (localCert == null) { txtApiResponse.Text = "<b>Requested certificate not found. Sending plain text request.</b>"; } else { txtApiResponse.Text = "<b>Requested certificate found. Sending signed request.</b>"; } byte[] msgBytes = utf8.GetBytes(xml); ContentInfo contentInfo = new ContentInfo(msgBytes); // Instantiate SignedCms object with the ContentInfo above. SignedCms signedCms = new SignedCms(contentInfo); // Create a signer object with the certificate we have loaded from the local store by thumbnail. CmsSigner cmsSigner = new CmsSigner(localCert); // sign the message signedCms.ComputeSignature(cmsSigner); // create serialized representation byte[] signedBytes = signedCms.Encode(); var signedData = Convert.ToBase64String(signedBytes); string response = _oauth.APIWebRequest("GET", "https://api.xero.com/api.xro/2.0/Invoices", null); if (response == "") { txtApiResponse.Text = "Your new status updated"; } btnSendStatusUpdate.Focus(); }
public XmlDocument Get_UserUpdates(oAuthLinkedIn OAuth, string LinkedInId, int Count) { string response = OAuth.APIWebRequest("GET", Global.GetNetworkUserUpdates + LinkedInId + "/network/updates?scope=self" + "&count=" + Count, null); xmlResult.Load(new StringReader(response)); return(xmlResult); }
private JObject ExecuteLinkedInRequest() { string response = _oauth.APIWebRequest("GET", string.Format("http://api.linkedin.com/v1/companies/{0}/updates?format=json", _companyID), null); JObject dynObj = (JObject)JsonConvert.DeserializeObject(response); return(dynObj); }
public XmlDocument Get_UserProfile(oAuthLinkedIn OAuth) { string response = OAuth.APIWebRequest("GET", "http://api.linkedin.com/v1/people/~:(id,first-name,headline,last-name,industry,site-standard-profile-request,api-standard-profile-request,member-url-resources,picture-url,current-status,summary,positions,main-address,location,distance,specialties,proposal-comments,associations,honors,interests,educations,phone-numbers,im-accounts,twitter-accounts,date-of-birth,email-address)", null); xmlResult.Load(new StringReader(response)); return(xmlResult); }
/// <summary> /// The Job Search API enables search across LinkedIn's job postings Keyword Wise. /// </summary> /// <param name="OAuth"></param> /// <param name="keyword"></param> /// <param name="Count"></param> /// <returns></returns> public XmlDocument Get_JobSearchKeyword(oAuthLinkedIn OAuth, string keyword, int Count) { string response = OAuth.APIWebRequest("GET", Global.GetJobSearchKeyword + keyword + "&count=" + Count, null); xmlResult.Load(new StringReader(response)); return(xmlResult); }
public string GetLinkedIN_CompanyUpdateById(oAuthLinkedIn OAuth, string CoampanyPageId) { string url = "https://api.linkedin.com/v1/companies/" + CoampanyPageId + "/updates?format=json"; string response = OAuth.APIWebRequest("GET", url, null); return(response); }
public string GetLinkedINCommentOnPagePost(oAuthLinkedIn oauth, string Updatekey, string PageId) { string url = "https://api.linkedin.com/v1/companies/" + PageId + "/updates/key=" + Updatekey + "?format=json"; string response = oauth.APIWebRequest("GET", url, null); return(response); }
public string SetImageStatusUpdate(oAuthLinkedIn OAuth, string msg, string file) { string xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><share><comment>" + msg + "</comment><content><title></title><submitted-image-url>" + file + "</submitted-image-url></content><visibility><code>anyone</code></visibility></share>"; string response = OAuth.APIWebRequest("POST", Global.StatusUpdateImage, xml); return(response); }
public string GetLinkedIN_CompanyProfileById(oAuthLinkedIn OAuth, string CoampanyPageId) { string url = "https://api.linkedin.com/v1/companies/" + CoampanyPageId + ":(id,name,email-domains,description,founded-year,end-year,locations,Specialties,website-url,status,employee-count-range,industries,company-type,logo-url,square-logo-url,blog-rss-url,num-followers,universal-name)?format=json"; string response = OAuth.APIWebRequest("GET", url, null); return(response); }
/// <summary> /// Displays the profile the requestor is allowed to see. /// </summary> /// <param name="OAuth"></param> /// <returns></returns> public XmlDocument Get_UserProfile(oAuthLinkedIn OAuth) { string response = OAuth.APIWebRequest("GET", Global.GetUserProfileUrl, null); xmlResult.Load(new StringReader(response)); return(xmlResult); }
public XmlDocument Get_NetworkUpdates(oAuthLinkedIn OAuth, int Count) { string response = OAuth.APIWebRequest("GET", Global.GetNetworkUpdates, null); xmlResult.Load(new StringReader(response)); return(xmlResult); }
public string GetLinkedIn_UserUpdates(oAuthLinkedIn OAuth, string LinkedInId, int Count) { string url = "https://api.linkedin.com/v1/people/id=" + LinkedInId + "/network/updates?scope=self" + "&count=" + Count + "?format=json"; string response = OAuth.APIWebRequest("GET", url, null); return(response); }
public XmlDocument GetCommentOnPagePost(oAuthLinkedIn oauth, string Updatekey) { string url = "https://api.linkedin.com/v1/people/~/network/updates/key=" + Updatekey + "/update-comments/"; string response = oauth.APIWebRequest("GET", url, null); XmlResult.Load(new StringReader(response)); return(XmlResult); }
public XmlDocument Get_CompanyUpdateById(oAuthLinkedIn OAuth, string CoampanyPageId) { string url = "https://api.linkedin.com/v1/companies/" + CoampanyPageId + "/updates"; string response = OAuth.APIWebRequest("GET", url, null); XmlResult.Load(new StringReader(response)); return(XmlResult); }
private void btnUpdateStatus_Click(object sender, EventArgs e) { txtAPIResponse.Text = ""; _oauth.Token = txtOauth_Access_token.Text; _oauth.TokenSecret = txtOauth_Access_tokenSecret.Text; _oauth.Verifier = txtOauth_verify.Text; string xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; xml += "<current-status>" + txtNewStatus.Text + "</current-status>"; string response = _oauth.APIWebRequest("PUT", "http://api.linkedin.com/v1/people/~/current-status", xml); if (response == "") { txtAPIResponse.Text = "Your new status updated"; } }
protected void btnSendStatusUpdate_Click(object sender, EventArgs e) { _oauth.Token = txtAccessToken.Text; _oauth.TokenSecret = txtAccessTokenSecret.Text; _oauth.Verifier = txtoAuth_verifier.Text; string xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; xml += "<current-status>It's really working .</current-status>"; string response = _oauth.APIWebRequest("PUT", "http://api.linkedin.com/v1/people/~/current-status", xml); if (response == "") { txtApiResponse.Text = "Your new status updated"; } btnSendStatusUpdate.Focus(); }
public string SetStatusUpdate(oAuthLinkedIn OAuth, string msg) { string xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; xml += "<current-status>" + msg + "</current-status>"; string response = OAuth.APIWebRequest("PUT", Global.StatusUpdate, xml); return(response); }
public XmlDocument GetLikeorNotOnPagePost(oAuthLinkedIn oauth, string Updatekey, string PageId) { string url = "https://api.linkedin.com/v1/companies/" + PageId + "/updates/key=" + Updatekey + "/is-liked/"; //string url = "https://api.linkedin.com/v1/people/~/network/updates/key=" + Updatekey + "/is-liked/"; string response = oauth.APIWebRequest("GET", url, null); XmlResult.Load(new StringReader(response)); return(XmlResult); }
public IHttpActionResult GetLinkedinCompanyPage(LinkedInManager LinkedInManager) { string UserId = LinkedInManager.UserId; oAuthLinkedIn _oauth = new oAuthLinkedIn(); LinkedInProfile objProfile = new LinkedInProfile(); List <Helper.AddlinkedinCompanyPage> lstAddLinkedinPage = new List <Helper.AddlinkedinCompanyPage>(); try { _oauth.ConsumerKey = ConfigurationManager.AppSettings["LinkedinApiKey"]; } catch (Exception ex) { Console.WriteLine(ex.Message); logger.Error(ex.Message); } try { _oauth.ConsumerSecret = ConfigurationManager.AppSettings["LinkedinSecretKey"]; } catch (Exception ex) { Console.WriteLine(ex.Message); logger.Error(ex.Message); } string access_token_Url = "https://www.linkedin.com/uas/oauth2/accessToken"; string access_token_postData = "grant_type=authorization_code&code=" + LinkedInManager.Code + "&redirect_uri=" + System.Web.HttpUtility.UrlEncode(ConfigurationManager.AppSettings["LinkedinCallBackURL"]) + "&client_id=" + ConfigurationManager.AppSettings["LinkedinApiKey"] + "&client_secret=" + ConfigurationManager.AppSettings["LinkedinSecretKey"]; LinkedInProfile.UserProfile objUserProfile = new LinkedInProfile.UserProfile(); string token = _oauth.APIWebRequestAccessToken("POST", access_token_Url, access_token_postData); var oathtoken = JObject.Parse(token); _oauth.Token = oathtoken["access_token"].ToString().TrimStart('"').TrimEnd('"'); string response = _oauth.APIWebRequest("GET", GlobusLinkedinLib.App.Core.Global.GetLinkedInCompanyPageUrl, null); try { var companypage = JObject.Parse(response); foreach (var item in companypage["values"]) { Helper.AddlinkedinCompanyPage objAddLinkedinPage = new Helper.AddlinkedinCompanyPage(); objAddLinkedinPage.PageId = item["id"].ToString(); objAddLinkedinPage.PageName = item["name"].ToString(); objAddLinkedinPage._Oauth = _oauth; lstAddLinkedinPage.Add(objAddLinkedinPage); } string data = new JavaScriptSerializer().Serialize(lstAddLinkedinPage); return(Ok(data)); } catch (Exception) { return(Ok("No Company Page Found")); } }
public XmlDocument Get_GroupUpdates(oAuthLinkedIn OAuth, int Count) { string response = OAuth.APIWebRequest("GET", Global.GetGroupUpdates, null); if (response != "") { xmlResult.Load(new StringReader(response)); } return(xmlResult); }
public string SetCommentOnPagePost(oAuthLinkedIn oauth, string PageId, string Updatekey, string comment) { string xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; xml += " <update-comment><comment>" + comment + "</comment></update-comment>"; string url = "https://api.linkedin.com/v1/companies/" + PageId + "/updates/key=" + Updatekey + "/update-comments-as-company/"; string response = oauth.APIWebRequest("POST", url, xml); return(response); }
public XmlDocument Get_CompanyProfileById(oAuthLinkedIn OAuth, string CoampanyPageId) { //string url = "https://api.linkedin.com/v1/companies/" + CoampanyPageId + ":(id,name,email-domains,description,founded-year,end-year,locations,Specialties,website-url,status,employee-count-range,industries,company-type,logo-url,square-logo-url,blog-rss-url,num-followers,universal-name,locations:(description),locations:(is-headquarters),locations:(is-active),locations:(address),locations:(address:(street1)),locations:(address:(street2)),locations:(address:(city)),locations:(address:(state)),locations:(address:(postal-code)),locations:(address:(country-code)),locations:(address:(region-code)),locations:(contact-info),locations:(contact-info:(phone1)),locations:(contact-info:(phone2)),locations:(contact-info:(fax)))"; string url = "https://api.linkedin.com/v1/companies/" + CoampanyPageId + ":(id,name,email-domains,description,founded-year,end-year,locations,Specialties,website-url,status,employee-count-range,industries,company-type,logo-url,square-logo-url,blog-rss-url,num-followers,universal-name)"; string response = OAuth.APIWebRequest("GET", url, null); XmlResult.Load(new StringReader(response)); return(XmlResult); }
public string SetCommentOnPost(oAuthLinkedIn OAuth, string postid, string msg) { string xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; xml += "<comment><text>" + msg + "</text></comment>"; string url = "https://api.linkedin.com/v1/posts/" + postid + "/comments"; string response = OAuth.APIWebRequest("POST", url, xml); return(response); }
public string SetLikeUpdate(oAuthLinkedIn OAuth, string postid, string msg) { string xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; xml += " <is-liked>" + msg + "</is-liked>"; string url = "https://api.linkedin.com/v1/posts/" + postid + "/relation-to-viewer/is-liked"; string response = OAuth.APIWebRequest("PUT", url, xml); return(response); }
/// <summary> /// The People Search API returns information about people. /// </summary> /// <param name="OAuth"></param> /// <param name="keyword"></param> /// <returns></returns> public XmlDocument Get_People_Search(oAuthLinkedIn OAuth, string keyword) { string response = string.Empty; try { response = OAuth.APIWebRequest("GET", Global.GetPeopleSearchUrl + keyword + "sort=distance", null); } catch { } xmlResult.Load(new StringReader(response)); return(xmlResult); }
public XmlDocument Get_People_Connection(oAuthLinkedIn OAuth) { string response = string.Empty; try { response = OAuth.APIWebRequest("GET", Global.GetPeopleConnectionUrl, null); } catch { } xmlResult.Load(new StringReader(response)); return(xmlResult); }
public XmlDocument SearchPeople(oAuthLinkedIn OAuth, string keyword) { string response = string.Empty; try { response = OAuth.APIWebRequest("GET", "http://api.linkedin.com/v1/people-search?keyword=" + keyword + "sort=distance", null); } catch { } xmlResult.Load(new StringReader(response)); return(xmlResult); }
public string SetLikeUpdateOnPagePost(oAuthLinkedIn OAuth, string postid, string msg) { string xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; xml += " <is-liked>" + msg + "</is-liked>"; string url = "https://api.linkedin.com/v1/people/~/network/updates/key=" + postid + "/is-liked"; string response = OAuth.APIWebRequest("PUT", url, xml); return(response); }