APIWebRequest() public method

WebRequestWithPut
public APIWebRequest ( string method, string url, string postData ) : string
method string WebRequestWithPut
url string
postData string
return string
コード例 #1
0
ファイル: Login.ascx.cs プロジェクト: gamzesambur/SageFrame
        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);
        }
コード例 #2
0
    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;
        }
    }
コード例 #3
0
    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();
    }
コード例 #4
0
        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);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        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);
        }
コード例 #7
0
        /// <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);
        }
コード例 #8
0
ファイル: Company.cs プロジェクト: kuggaa/SociaBoard
        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);
        }
コード例 #9
0
ファイル: Company.cs プロジェクト: kuggaa/SociaBoard
        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);
        }
コード例 #10
0
        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);
        }
コード例 #11
0
ファイル: Company.cs プロジェクト: kuggaa/SociaBoard
        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);
        }
コード例 #12
0
ファイル: People.cs プロジェクト: thinkgandhi/socioboard
        /// <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);
        }
コード例 #13
0
        public XmlDocument Get_NetworkUpdates(oAuthLinkedIn OAuth, int Count)
        {
            string response = OAuth.APIWebRequest("GET", Global.GetNetworkUpdates, null);

            xmlResult.Load(new StringReader(response));
            return(xmlResult);
        }
コード例 #14
0
        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);
        }
コード例 #15
0
ファイル: Company.cs プロジェクト: hamik112/myfashionmarketer
        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);
        }
コード例 #16
0
ファイル: Company.cs プロジェクト: hamik112/myfashionmarketer
        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);
        }
コード例 #17
0
        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";
            }
        }
コード例 #18
0
    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();
    }
コード例 #19
0
        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);
        }
コード例 #20
0
ファイル: Company.cs プロジェクト: hamik112/myfashionmarketer
        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);
        }
コード例 #21
0
        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"));
            }
        }
コード例 #22
0
        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);
        }
コード例 #23
0
ファイル: Company.cs プロジェクト: hamik112/myfashionmarketer
        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);
        }
コード例 #24
0
ファイル: Company.cs プロジェクト: hamik112/myfashionmarketer
        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);
        }
コード例 #25
0
        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);
        }
コード例 #26
0
        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);
        }
コード例 #27
0
ファイル: People.cs プロジェクト: thinkgandhi/socioboard
        /// <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);
        }
コード例 #28
0
ファイル: People.cs プロジェクト: thinkgandhi/socioboard
        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);
        }
コード例 #29
0
        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);
        }
コード例 #30
0
ファイル: Company.cs プロジェクト: hamik112/myfashionmarketer
        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);
        }