Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/285.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何在asp.net中使用QuickBook发票api_C#_Asp.net_Quickbooks_Intuit Partner Platform_Quickbooks Online - Fatal编程技术网

C# 如何在asp.net中使用QuickBook发票api

C# 如何在asp.net中使用QuickBook发票api,c#,asp.net,quickbooks,intuit-partner-platform,quickbooks-online,C#,Asp.net,Quickbooks,Intuit Partner Platform,Quickbooks Online,我需要将QuickBookAPI与我的web应用程序集成。我刚刚创建了一个示例应用程序来实现它。我对此很奇怪,我真的不知道如何连接api或使用api。我提到了我从(“”)中获取的代码。 我尝试在应用程序管理器中创建一个应用程序,我已附加图像FYR。输入所有这些详细信息后,我不会得到“accessTokenSecret”值。这里我刚刚输入了apptoken值A作为accessToken值。Iam在服务上下文行中收到“未经授权”的异常。帮我做这个 代码: using System; using Sy

我需要将QuickBookAPI与我的web应用程序集成。我刚刚创建了一个示例应用程序来实现它。我对此很奇怪,我真的不知道如何连接api或使用api。我提到了我从(“”)中获取的代码。 我尝试在应用程序管理器中创建一个应用程序,我已附加图像FYR。输入所有这些详细信息后,我不会得到“accessTokenSecret”值。这里我刚刚输入了apptoken值A作为accessToken值。Iam在服务上下文行中收到“未经授权”的异常。帮我做这个

代码:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Intuit.Ipp.Core;
using Intuit.Ipp.Services;
using Intuit.Ipp.Data;
using Intuit.Ipp.Utility;
using Intuit.Ipp.Security;
using Intuit.Ipp.Data.Qbo;
using Newtonsoft.Json;

namespace QuickBookApiConsumption
{
    public partial class Invoice : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnsendInvoiceDetails_Click(object sender, EventArgs e)
        {
            string accessToke = "";
            string appToken = "297db54bb5526b494dba97fb2a41063192cd";
            string accessTokenSecret = "297db54bb5526b494dba97fb2a41063192cd";
            string consumerKey = "qyprdMSG1YHpCPSlWQZTiKVc78dywR";
            string consumerSecret = "JPfXE17YnCPGU9m9vuXkF2M765bDb7blhcLB7HeF";
            string companyID = "812947125";
            OAuthRequestValidator oauthValidator = new OAuthRequestValidator(appToken, accessTokenSecret, consumerKey, consumerSecret);
            ServiceContext context = new ServiceContext(oauthValidator, appToken, companyID, IntuitServicesType.QBO);
            DataServices service = new DataServices(context);
            Invoice os = new Invoice();
            Intuit.Ipp.Data.Qbo.InvoiceHeader o = new Intuit.Ipp.Data.Qbo.InvoiceHeader();
            o.CustomerName = "Viki";
            o.CustomerId = new Intuit.Ipp.Data.Qbo.IdType { Value = "12" };
            o.ShipMethodName = "Email";
            o.SubTotalAmt = 3.00m;
            o.TotalAmt = 6.00m;
            o.ShipAddr = new Intuit.Ipp.Data.Qbo.PhysicalAddress { City = "Chni" };

        }
    }
}
图像:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Intuit.Ipp.Core;
using Intuit.Ipp.Services;
using Intuit.Ipp.Data;
using Intuit.Ipp.Utility;
using Intuit.Ipp.Security;
using Intuit.Ipp.Data.Qbo;
using Newtonsoft.Json;

namespace QuickBookApiConsumption
{
    public partial class Invoice : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnsendInvoiceDetails_Click(object sender, EventArgs e)
        {
            string accessToke = "";
            string appToken = "297db54bb5526b494dba97fb2a41063192cd";
            string accessTokenSecret = "297db54bb5526b494dba97fb2a41063192cd";
            string consumerKey = "qyprdMSG1YHpCPSlWQZTiKVc78dywR";
            string consumerSecret = "JPfXE17YnCPGU9m9vuXkF2M765bDb7blhcLB7HeF";
            string companyID = "812947125";
            OAuthRequestValidator oauthValidator = new OAuthRequestValidator(appToken, accessTokenSecret, consumerKey, consumerSecret);
            ServiceContext context = new ServiceContext(oauthValidator, appToken, companyID, IntuitServicesType.QBO);
            DataServices service = new DataServices(context);
            Invoice os = new Invoice();
            Intuit.Ipp.Data.Qbo.InvoiceHeader o = new Intuit.Ipp.Data.Qbo.InvoiceHeader();
            o.CustomerName = "Viki";
            o.CustomerId = new Intuit.Ipp.Data.Qbo.IdType { Value = "12" };
            o.ShipMethodName = "Email";
            o.SubTotalAmt = 3.00m;
            o.TotalAmt = 6.00m;
            o.ShipAddr = new Intuit.Ipp.Data.Qbo.PhysicalAddress { City = "Chni" };

        }
    }
}

您应该检查是否使用了正确的基本URL

使用一些RESTClient[mozilla浏览器的ex-RESTClient插件],验证OAuth令牌。

标题(内容类型)配置窗口。

您可以使用以下命令

 public void ConnectUsingAuth()
    {
        string accessToken = ConfigurationManager.AppSettings["AccessTokenQBD"];
        string accessTokenSecret = ConfigurationManager.AppSettings["access-secret"];
        string consumerKey = ConfigurationManager.AppSettings["consumerKey"];
        string consumerKeySecret = ConfigurationManager.AppSettings["consumerSecret"];
        string URI = "https://apiend-point";
        WebRequest webRequest = WebRequest.Create(URI);
        webRequest.Headers.Add("ContentType", "text/xml");
        OAuthRequestValidator target = new OAuthRequestValidator(accessToken, accessTokenSecret, consumerKey, consumerKeySecret);
    }
[更好的选项]您可以从github下载示例程序并配置web.config(使用正确的使用者密钥和密码)

您可以使用APIExplorer工具测试所有这些API端点

文件- 蜂房探险者-

谢谢