Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //using DevDefined.OAuth.Consumer;
- //using DevDefined.OAuth.Framework;
- protected void GetBalanceSheet()
- {
- OAuthConsumerContext consumerContext = new OAuthConsumerContext
- {
- ConsumerKey = ConfigurationManager.AppSettings["consumerKey"].ToString(),
- SignatureMethod = SignatureMethod.HmacSha1,
- ConsumerSecret = ConfigurationManager.AppSettings["consumerSecret"].ToString()
- };
- OAuthSession oSession = new OAuthSession(consumerContext, "https://oauth.intuit.com/oauth/v1/get_request_token",
- "https://workplace.intuit.com/Connect/Begin",
- "https://oauth.intuit.com/oauth/v1/get_access_token");
- oSession.ConsumerContext.UseHeaderForOAuthParameters = true;
- oSession.AccessToken = new TokenBase
- {
- Token = Session["accessToken"].ToString(),
- ConsumerKey = ConfigurationManager.AppSettings["consumerKey"].ToString(),
- TokenSecret = Session["accessTokenSecret"].ToString()
- };
- var body = "<AdvancedReportQuery xmlns=\"http://www.intuit.com/sb/cdm/v2\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.intuit.com/sb/cdm/v2 ..//RestDataFilter.xsd\"><BalanceSheetStd><OfferingId>ipp</OfferingId><EndTransactionDate>2012-06-01</EndTransactionDate></BalanceSheetStd></AdvancedReportQuery>";
- IConsumerRequest conReq = oSession.Request();
- conReq = conReq.Post().WithRawContentType("text/xml").WithRawContent(System.Text.Encoding.ASCII.GetBytes(body)); ;
- conReq = conReq.ForUrl("https://services.intuit.com/sb/advancedreport/v2/508053445");
- try
- {
- conReq = conReq.SignWithToken();
- }
- catch (Exception ex)
- {
- throw ex;
- }
- string header = conReq.Context.GenerateOAuthParametersForHeader();
- string serviceResponse = conReq.ReadBody();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement