我正在使用QB桌面版。並且我想爲我的QuickBooks桌面版更新/重新生成'訪問令牌'/'訪問令牌保密',因爲它們將在180天內過期,並且必須在令牌到期後的30天內進行續訂。 我試圖與下面的代碼,但它不工作一樣,給人誤差,因紐特人快速書籤令牌更新和到期
<RestResponse xmlns="http://www.intuit.com/sb/cdm/v2"><Error RequestId="14aa97c48321489db48254e4bdb25d00"><RequestName>ErrorRequest</RequestName><ProcessedTime>2013-04-05T11:43:08+00:00</ProcessedTime><ErrorCode>401</ErrorCode><ErrorDesc>Invalid security token</ErrorDesc></Error></RestResponse>
沒有爲令牌generatetion沒有任何記錄的請求/響應。
string myRealmId = "000000000000000";
string myAccessToken = "0000000000000000000000000000000000000";
string myAccessTokenSecret = "00000000000000000000000000000000000";
string myAppToken = "00000000000000000000000000000000000";
string myConsumerKey ="00000000000000000000000000000000000";
string myConsumerSecret ="00000000000000000000000000000000000";
OAuthConsumerContext consumerContext = new OAuthConsumerContext
{
ConsumerKey =myConsumerKey,
SignatureMethod = SignatureMethod.HmacSha1,
ConsumerSecret = myConsumerSecret
};
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
{
Realm = myRealmId,
Token = myAccessToken,
ConsumerKey = myConsumerKey,
TokenSecret = myAccessTokenSecret
};
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) {}
string serviceResponse = conReq.ReadBody();
}
catch (Exception Err) {}
}
感謝,
Reshma D.
感謝您的回覆。您可以幫助我們通過數據服務調用此API。就像我們調用數據服務方法,例如,Intuit.Ipp.Data.Qbd.Customer qbdCustomer = dataServices.FindById(qbdCustomer1);感謝您的回覆。你能幫我們通過數據服務來調用這個API嗎?例如,我們稱數據服務方法爲 Intuit.Ipp.Data.Qbd.Customer qbdCustomer = dataServices.FindById (qbdCustomer1); 我們無法確定哪個Intuit Quickbooks對象可以幫助我們實現。提前感謝,Reshma D. –
Reshma
2013-04-08 12:37:19
此調用在DevKit中不可用。我已經通過一個如何使用DevDefined來調用API的例子更新了上面的答案。 – 2013-04-08 17:41:29
謝謝彼得。我會嘗試給予參考。 – Reshma 2013-04-09 09:12:36