2017-05-04 14 views
0

quickbook apiを使用してクイックブックで販売レシートを作成しようとしました。私のほとんどの売上領収書は問題なしでクイックブックに作成されました。しかし、quickbook apiは1つの注文の例外をスローします。私は、エラーの下に持っている:以下無効な参照ID:Line.SalesItemLineDetail.ItemRef

{ 
    "Fault": { 
    "Error": [ 
     { 
     "Message": "Invalid Reference Id", 
     "Detail": "Invalid Reference Id : Line.SalesItemLineDetail.ItemRef", 
     "code": "2500", 
     "element": "Line.SalesItemLineDetail.ItemRef" 
     } 
    ], 
    "type": "ValidationFault" 
    }, 
    "time": "2017-05-04T03:32:18.942-07:00" 
} 

は、私はAPIを試してみましたJSONです:

{ 
    "SalesReceiptEx":null, 
    "AutoDocNumber":null, 
    "CustomerRef":{ 
     "name":"Alexander", 
     "type":null, 
     "value":"325" 
    }, 
    "CustomerMemo":null, 
    "BillAddr":{ 
     "Id":"1", 
     "Line1":"Alexander Kryukov", 
     "Line2":"22 Chester Terrace", 
     "Line3":"London", 
     "Line4":"United Kingdom,GB", 
     "Line5":"NW1 4ND", 
     "City":null, 
     "Country":null, 
     "CountryCode":null, 
     "CountrySubDivisionCode":null, 
     "PostalCode":null, 
     "PostalCodeSuffix":null, 
     "Lat":null, 
     "Long":null, 
     "Tag":null, 
     "Note":null 
    }, 
    "ShipAddr":{ 
     "Id":"2", 
     "Line1":"Alexander Kryukov", 
     "Line2":"22 Chester Terrace", 
     "Line3":null, 
     "Line4":null, 
     "Line5":null, 
     "City":"London", 
     "Country":"United Kingdom", 
     "CountryCode":null, 
     "CountrySubDivisionCode":"GB", 
     "PostalCode":"NW1 4ND", 
     "PostalCodeSuffix":null, 
     "Lat":null, 
     "Long":null, 
     "Tag":null, 
     "Note":null 
    }, 
    "RemitToRef":null, 
    "ClassRef":null, 
    "SalesTermRef":null, 
    "DueDate":null, 
    "SalesRepRef":null, 
    "PONumber":null, 
    "FOB":null, 
    "ShipMethodRef":null, 
    "ShipDate":null, 
    "TrackingNum":null, 
    "GlobalTaxCalculation":null, 
    "TotalAmt":"136.90000", 
    "HomeTotalAmt":null, 
    "ApplyTaxAfterDiscount":null, 
    "TemplateRef":null, 
    "PrintStatus":null, 
    "EmailStatus":null, 
    "BillEmail":{ 
     "Id":null, 
     "Address":"[email protected]", 
     "Default":null, 
     "Tag":null 
    }, 
    "ARAccountRef":null, 
    "Balance":null, 
    "HomeBalance":null, 
    "FinanceCharge":null, 
    "PaymentMethodRef":null, 
    "PaymentRefNum":null, 
    "PaymentType":null, 
    "CheckPayment":null, 
    "CreditCardPayment":null, 
    "DepositToAccountRef":{ 
     "name":"Business Bank Account HSBC", 
     "type":null, 
     "value":58 
    }, 
    "DeliveryInfo":null, 
    "DiscountRate":null, 
    "DiscountAmt":null, 
    "GovtTxnRefIdentifier":null, 
    "DocNumber":1163080716, 
    "TxnDate":"2017-05-04", 
    "DepartmentRef":null, 
    "CurrencyRef":null, 
    "ExchangeRate":null, 
    "PrivateNote":null, 
    "TxnStatus":null, 
    "LinkedTxn":null, 
    "Line":[ 
     { 
     "Id":1, 
     "LineNum":1, 
     "Description":"Flowery Floater Birthday Number", 
     "Amount":"43.29167", 
     "LinkedTxn":null, 
     "DetailType":"SalesItemLineDetail", 
     "PaymentLineDetail":null, 
     "DiscountLineDetail":null, 
     "TaxLineDetail":null, 
     "SalesItemLineDetail":{ 
      "ServiceDate":null, 
      "TaxInclusiveAmt":null, 
      "DiscountRate":null, 
      "DiscountAmt":null, 
      "SalesItemLineDetailEx":null, 
      "ItemRef":{ 
       "name":"Flowery Floater Birthday Number", 
       "type":null, 
       "value":"1" 
      }, 
      "ClassRef":null, 
      "UnitPrice":"43.29167", 
      "RatePercent":null, 
      "PriceLevelRef":null, 
      "MarkupInfo":null, 
      "Qty":"1", 
      "UOMRef":null, 
      "ItemAccountRef":null, 
      "InventorySiteRef":null, 
      "TaxCodeRef":{ 
       "name":null, 
       "type":null, 
       "value":2 
      } 
     }, 
     "DescriptionLineDetail":null, 
     "ItemBasedExpenseLineDetail":null, 
     "AccountBasedExpenseLineDetail":null, 
     "DepositLineDetail":null, 
     "PurchaseOrderItemLineDetail":null, 
     "ItemReceiptLineDetail":null, 
     "JournalEntryLineDetail":null, 
     "GroupLineDetail":null, 
     "SubTotalLineDetail":null, 
     "TDSLineDetail":null, 
     "CustomField":null, 
     "LineEx":null 
     }, 
     { 
     "Id":2, 
     "LineNum":2, 
     "Description":"Custom Product", 
     "Amount":"37.50000", 
     "LinkedTxn":null, 
     "DetailType":"SalesItemLineDetail", 
     "PaymentLineDetail":null, 
     "DiscountLineDetail":null, 
     "TaxLineDetail":null, 
     "SalesItemLineDetail":{ 
      "ServiceDate":null, 
      "TaxInclusiveAmt":null, 
      "DiscountRate":null, 
      "DiscountAmt":null, 
      "SalesItemLineDetailEx":null, 
      "ItemRef":{ 
       "name":"Custom Product", 
       "type":null, 
       "value":"10" 
      }, 
      "ClassRef":null, 
      "UnitPrice":"3.75000", 
      "RatePercent":null, 
      "PriceLevelRef":null, 
      "MarkupInfo":null, 
      "Qty":"10", 
      "UOMRef":null, 
      "ItemAccountRef":null, 
      "InventorySiteRef":null, 
      "TaxCodeRef":{ 
       "name":null, 
       "type":null, 
       "value":2 
      } 
     }, 
     "DescriptionLineDetail":null, 
     "ItemBasedExpenseLineDetail":null, 
     "AccountBasedExpenseLineDetail":null, 
     "DepositLineDetail":null, 
     "PurchaseOrderItemLineDetail":null, 
     "ItemReceiptLineDetail":null, 
     "JournalEntryLineDetail":null, 
     "GroupLineDetail":null, 
     "SubTotalLineDetail":null, 
     "TDSLineDetail":null, 
     "CustomField":null, 
     "LineEx":null 
     }, 
     { 
     "Id":3, 
     "LineNum":3, 
     "Description":"Additional Delivery Charge", 
     "Amount":"30.00000", 
     "LinkedTxn":null, 
     "DetailType":"SalesItemLineDetail", 
     "PaymentLineDetail":null, 
     "DiscountLineDetail":null, 
     "TaxLineDetail":null, 
     "SalesItemLineDetail":{ 
      "ServiceDate":null, 
      "TaxInclusiveAmt":null, 
      "DiscountRate":null, 
      "DiscountAmt":null, 
      "SalesItemLineDetailEx":null, 
      "ItemRef":{ 
       "name":"Additional Delivery Charge", 
       "type":null, 
       "value":"1" 
      }, 
      "ClassRef":null, 
      "UnitPrice":"30.00000", 
      "RatePercent":null, 
      "PriceLevelRef":null, 
      "MarkupInfo":null, 
      "Qty":"1", 
      "UOMRef":null, 
      "ItemAccountRef":null, 
      "InventorySiteRef":null, 
      "TaxCodeRef":{ 
       "name":null, 
       "type":null, 
       "value":2 
      } 
     }, 
     "DescriptionLineDetail":null, 
     "ItemBasedExpenseLineDetail":null, 
     "AccountBasedExpenseLineDetail":null, 
     "DepositLineDetail":null, 
     "PurchaseOrderItemLineDetail":null, 
     "ItemReceiptLineDetail":null, 
     "JournalEntryLineDetail":null, 
     "GroupLineDetail":null, 
     "SubTotalLineDetail":null, 
     "TDSLineDetail":null, 
     "CustomField":null, 
     "LineEx":null 
     }, 
     { 
     "Id":4, 
     "LineNum":4, 
     "Description":"Shipping Cost", 
     "Amount":"3.29167", 
     "LinkedTxn":null, 
     "DetailType":"SalesItemLineDetail", 
     "PaymentLineDetail":null, 
     "DiscountLineDetail":null, 
     "TaxLineDetail":null, 
     "SalesItemLineDetail":{ 
      "ServiceDate":null, 
      "TaxInclusiveAmt":null, 
      "DiscountRate":null, 
      "DiscountAmt":null, 
      "SalesItemLineDetailEx":null, 
      "ItemRef":{ 
       "name":"Shipping Cost", 
       "type":null, 
       "value":"1" 
      }, 
      "ClassRef":null, 
      "UnitPrice":"3.29167", 
      "RatePercent":null, 
      "PriceLevelRef":null, 
      "MarkupInfo":null, 
      "Qty":"1", 
      "UOMRef":null, 
      "ItemAccountRef":null, 
      "InventorySiteRef":null, 
      "TaxCodeRef":{ 
       "name":null, 
       "type":null, 
       "value":2 
      } 
     }, 
     "DescriptionLineDetail":null, 
     "ItemBasedExpenseLineDetail":null, 
     "AccountBasedExpenseLineDetail":null, 
     "DepositLineDetail":null, 
     "PurchaseOrderItemLineDetail":null, 
     "ItemReceiptLineDetail":null, 
     "JournalEntryLineDetail":null, 
     "GroupLineDetail":null, 
     "SubTotalLineDetail":null, 
     "TDSLineDetail":null, 
     "CustomField":null, 
     "LineEx":null 
     } 
    ], 
    "TxnTaxDetail":null, 
    "TxnSource":null, 
    "TaxFormType":null, 
    "TaxFormNum":null, 
    "TransactionLocationType":null, 
    "Id":null, 
    "SyncToken":null, 
    "MetaData":null, 
    "CustomField":null, 
    "AttachableRef":null, 
    "domain":null, 
    "status":null, 
    "sparse":null 
} 

誰もがお勧めでした、この要求に実際の問題は何ですか?

答えて

0

エラーメッセージは、問題があるまさに示していますあなたの要求に基づいて

 "Message": "Invalid Reference Id", 
     "Detail": "Invalid Reference Id : Line.SalesItemLineDetail.ItemRef", 
     "code": "2500", 
     "element": "Line.SalesItemLineDetail.ItemRef" 

あなただけのこれらの値を発明ではなく、実際のQuickBooksからこれらを照会しているように、それが見えます。

私はあなたの項目が一つと呼ばれ、他にそれは全く別の何かと呼ばれていますので、一箇所でこれを仮定している:両方のケースで

"ItemRef":{ 
       "name":"Shipping Cost", 
       "type":null, 
       "value":"1" 
      }, 

Idvalue Sが同一であるにもかかわらず(1) :

"ItemRef":{ 
       "name":"Additional Delivery Charge", 
       "type":null, 
       "value":"1" 
      }, 

これらの数字を作成することはできません。彼らはId Intuitから照会する必要がある値です。

行うことによって、それらをクエリ:

SELECT * FROM Item 
関連する問題