当我查询类型为“Cost of Goods Sold”的帐户时,如何返回 ExpenseAccountRef?

问题描述

我目前需要另外两个必填字段来创建非库存项目
ExpenseAccountRef.valueExpenseAccountRef。姓名

我已针对 AccountType = 'Cost of Goods Sold' 发出查询

Account.Id = ExpenseAccountRef.value 吗?
Account.Name = ExpenseAccount.name 吗?

使用该对象中的 Account.Id 和 Account.Name 分别为 ExpenseAccountRef.value 和 ExpenseAccountRef.name。

请求网址:

GET /v3/company/4620816365171303340/query?query=select * from Account where AccountType = 'Cost of Goods Sold'&minorversion=59

Content type:text/plain
Production Base URL:https://quickbooks.api.intuit.com
SandBox Base URL:https://sandBox-quickbooks.api.intuit.com

查询

select * from Account where AccountType = 
'Cost of Goods Sold'

返回:

{
 "QueryResponse": {
  "Account": [
   {
    "Name": "Cost of Goods Sold","SubAccount": false,"FullyQualifiedname": "Cost of Goods Sold","Active": true,"Classification": "Expense","AccountType": "Cost of Goods Sold","AccountSubType": "SuppliesMaterialsCogs","CurrentBalance": 0,"CurrentBalanceWithSubAccounts": 0,"CurrencyRef": {
     "value": "USD","name": "United States Dollar"
    },"domain": "QBO","sparse": false,"Id": "80","SyncToken": "0","MetaData": {
     "CreateTime": "2021-05-01T10:36:04-07:00","LastUpdatedTime": "2021-05-01T10:36:04-07:00"
    }
   },{
    "Name": "MyJobs_test","FullyQualifiedname": "MyJobs_test","AccountSubType": "CostOfLaborCos","Id": "91","MetaData": {
     "CreateTime": "2021-07-13T14:31:01-07:00","LastUpdatedTime": "2021-07-13T14:31:01-07:00"
    }
   }
  ],"startPosition": 1,"maxResults": 2
 },"time": "2021-07-15T13:21:57.267-07:00"
}

来自 Intuit 官方开发人员文档的 ExpenseAccountRef 信息
"引用用于向供应商支付此项目的费用帐户。
必须是帐户类型为销货成本的帐户。
查询帐户名称列表资源以确定此引用的适当帐户对象。
分别为 ExpenseAccountRef.value 和 ExpenseAccountRef.name 使用该对象中的 Account.Id 和 Account.Name。"
https://developer.intuit.com/app/developer/qbo/docs/api/accounting/most-commonly-used/item#create-an-item

解决方法

是的,你做对了!

正如您引用的文档所说:

“使用 Account.Id ... 作为 ExpenseAccountRef.value

和:

“Account.Name ... 用于 ExpenseAccountRef.name”

您在此处提出的问题是正确的陈述!

Account.Id = ExpenseAccountRef.value 吗?

Account.Name = ExpenseAccount.name 吗?

您回答了自己的问题。呜呼!你去吧! :-)