连接QuickBooks Anywhere到QuickBooks桌面

时间:2013-01-15 21:42:41

标签: intuit-partner-platform

我试图从任何地方的QuickBooks连接到QuickBooks桌面,但是,我没有看到我的QuickBooks桌面实例,Joe的测试公司。我只看到了我的QuickBooks Online实例。

我认为问题是我的网址:

https://qbo.intuit.com/qbo1/rest/user/v2/

QuickBooks Desktop的基本URL是什么?

这是我的代码:

        public void GetAccessTokenAndSecret()
    {
        string oauth_callback_url = HttpContext.Current.Request.RawUrl;
        oauth_callback_url = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) + oauth_callback_url;
        string consumerKey = _qboSettings.ConsumerKey;
        string consumerSecret = _qboSettings.ConsumerKeySecret;
        var oauthLink = Constants.OauthEndPoints.IdFedOAuthBaseUrl;
        IToken token = (IToken)HttpContext.Current.Session["requestToken"];
        IOAuthSession session = CreateSession();
        IToken requestToken = session.GetRequestToken();
        HttpContext.Current.Session["requestToken"] = requestToken;
        string RequestToken = requestToken.Token;
        string TokenSecret = requestToken.TokenSecret;
        oauthLink = Constants.OauthEndPoints.AuthorizeUrl + "?oauth_token=" + RequestToken + "&oauth_callback=" + UriUtility.UrlEncode(oauth_callback_url);
        HttpContext.Current.Response.Redirect(oauthLink);

    }

    /// <summary>
    /// Creates Session
    /// </summary>
    /// <returns>Returns OAuth Session</returns>
    protected IOAuthSession CreateSession()
    {
        OAuthConsumerContext consumerContext = new OAuthConsumerContext
        {
            ConsumerKey = _qboSettings.ConsumerKey,
            ConsumerSecret = _qboSettings.ConsumerKeySecret,
            SignatureMethod = SignatureMethod.HmacSha1
        };
        return new OAuthSession(consumerContext,
                                        Constants.OauthEndPoints.IdFedOAuthBaseUrl + Constants.OauthEndPoints.UrlRequestToken,
                                        Constants.OauthEndPoints.IdFedOAuthBaseUrl,
                                        Constants.OauthEndPoints.IdFedOAuthBaseUrl + Constants.OauthEndPoints.UrlAccessToken);
    }

以下是我的常数:

using System.Globalization;

namespace HelloIntuitAnywhere.Utilities
{
using System.Configuration;
using System.Web;

/// <summary>
/// Contains Constants.
/// </summary>
internal class Constants
{

    static string Url_Request_Token = "/get_request_token";
    static string Url_Access_Token = "/get_access_token";
    static string Intuit_OAuth_BaseUrl ="https://oauth.intuit.com/oauth/v1";
    static string Intuit_Workplace_AuthorizeUrl = "https://workplace.intuit.com/Connect/Begin";
    static string BlueDot_AppMenuUrl = "https://workplace.intuit.com/api/v1/Account/AppMenu";
    static string DisconnectUr = "https://appcenter.intuit.com/api/v1/Connection/Disconnect";
    static string oauth_callback_url = HttpContext.Current.Request.RawUrl.Replace("Configure", "OAuthHandler");
    static string menuProxy = "MenuProxy.aspx";
    static string grantUrl = "OauthGrant.aspx";
    static string qbo_base_url = "https://qbo.intuit.com/qbo1/rest/user/v2/";
    static string openid_identifier = "https://openid.intuit.com/Identity-YourAppName";


    /// <summary>
    /// OAuth EndPoints.
    /// </summary>
    internal class OauthEndPoints
    {
        /// <summary>
        /// Url Request Token
        /// </summary>
        internal static string UrlRequestToken = Url_Request_Token != null ?
            Url_Request_Token.ToString(CultureInfo.InvariantCulture) : "/get_request_token";

        /// <summary>
        /// Url Access Token
        /// </summary>
        internal static string UrlAccessToken = Url_Access_Token != null ?
            Url_Access_Token.ToString(CultureInfo.InvariantCulture) : "/get_access_token";

        /// <summary>
        /// Federation base url.
        /// </summary>
        internal static string IdFedOAuthBaseUrl = Intuit_OAuth_BaseUrl != null ?
            Intuit_OAuth_BaseUrl.ToString(CultureInfo.InvariantCulture) : "https://oauth.intuit.com/oauth/v1";

        /// <summary>
        /// Authorize url.
        /// </summary>
        internal static string AuthorizeUrl = Intuit_Workplace_AuthorizeUrl != null ?
            Intuit_Workplace_AuthorizeUrl.ToString(CultureInfo.InvariantCulture) : "https://workplace.intuit.com/Connect/Begin";
    }

    /// <summary>
    /// Intuit Anywhere Endpoints.
    /// </summary>
    internal class IaEndPoints
    {
        /// <summary>
        /// BlueDot Menu Url.
        /// </summary>
        internal static string BlueDotAppMenuUrl = BlueDot_AppMenuUrl != null ?
            BlueDot_AppMenuUrl.ToString(CultureInfo.InvariantCulture) : "https://workplace.intuit.com/api/v1/Account/AppMenu";

        /// <summary>
        /// Disconnect url.
        /// </summary>
        internal static string DisconnectUrl = DisconnectUrl != null ?
            DisconnectUrl.ToString(CultureInfo.InvariantCulture) : "https://appcenter.intuit.com/api/v1/Connection/Disconnect";
    }
}
}

1 个答案:

答案 0 :(得分:1)

  

QuickBooks Desktop的基本URL是什么?

根据documentation,QuickBooks桌面的IDS网址遵循以下格式:

https://services.intuit.com/sb/<objectName>/v2/<realmID>

然而,你遇到的问题是:

  

我只看到了我的QuickBooks Online实例。

与基本URL无关。这听起来更像是您没有设置Sync Manager,或者您的应用程序设置没有勾选QuickBooks桌面选项以允许桌面版QuickBooks连接到您的应用程序。