我在我的.NET应用程序中使用适用于QuickBooks v3.0的IPP .NET SDK在我的应用程序和QuickBooks Online之间交换数据。如何使用此SDK从QuickBooks下载PDF发票?
答案 0 :(得分:1)
.Net SDK 2.2.0仅支持最高v79的QBO v3服务。 如果您需要支持,那么您需要使用dev定义的库进行直接的http调用。 下面添加了示例GET和POST请求。修改PDF端点的相同内容 - https://developer.intuit.com/docs/api/accounting/Invoice
GET https://gist.github.com/IntuitDeveloperRelations/0913b4c224de758fde0a
POST
//string res = CreateV3Customer(consumerKey, consumerSecret, accessToken, accessTokenSecret, realmId);
public string CreateV3Customer(string consumerKey, string consumerSecret, string accessToken, string accessTokenSecret, string realmId)
{
StringBuilder request = new StringBuilder();
StringBuilder response = new StringBuilder();
var requestBody = "{\"FamilyName\":\"Jack\"}";
HttpWebRequest httpWebRequest = WebRequest.Create("https://quickbooks.api.intuit.com/v3/company/"+realmId+"/customer") as HttpWebRequest;
httpWebRequest.Method = "POST";
httpWebRequest.ContentType = "application/json";
httpWebRequest.Headers.Add("Authorization", GetDevDefinedOAuthHeader(consumerKey, consumerSecret, accessToken,accessTokenSecret,httpWebRequest, requestBody));
request.Append(requestBody);
UTF8Encoding encoding = new UTF8Encoding();
byte[] content = encoding.GetBytes(request.ToString());
using (var stream = httpWebRequest.GetRequestStream())
{
stream.Write(content, 0, content.Length);
}
HttpWebResponse httpWebResponse = httpWebRequest.GetResponse() as HttpWebResponse;
using (Stream data = httpWebResponse.GetResponseStream())
{
string customerr = new StreamReader(data).ReadToEnd();
return customerr;
}
}
答案 1 :(得分:0)