问题
I am using npm quickbooks. I want to fetch the invoice fields for mapping with my local fields. But could not find any API or function for the same or maybe I am not on the track. So can anyone please explain step by step How to map our local fields with the quick books invoice?
I can use getInvoice but the issue is I have to pass the quick books invoice id in it.
.getInvoice("150", (err, data) => {
if (err) {
return reject(err);
} else {
return resolve(data);
}
});
But I need only the fields for mapping.
回答1:
The QuickBooks Online API itself does not have a way to get a list of available fields.
The closest you're going to get is to manually download and parse the .XSD
documents that Intuit defines for the API.
You can download the .XSD
files here:
- https://developer.intuit.com/app/developer/qbo/docs/develop/explore-the-quickbooks-online-api/minor-versions#working-with-minor-versions
That will give you data like this:
<xs:element name="CustomerRef" type="ReferenceType"
minOccurs="0">
<xs:annotation>
<xs:documentation>
Product: ALL
Description: Reference to a Customer or job.
Filterable: QBW
InputType: ReadWrite
BusinessRules: QBW: CustomerRef is mandatory for some SalesTransactions like
Invoice
</xs:documentation>
</xs:annotation>
</xs:element>
Which you could then parse out and determine which fields are available for which object type.
It's going to be super complex, and super time consuming for you.
You're likely way better off just referencing Intuit's developer documentation like the other commenters have already told you:
- https://developer.intuit.com/app/developer/qbo/docs/api/accounting/most-commonly-used/invoice#full-update-an-invoice
来源:https://stackoverflow.com/questions/61819079/how-to-get-invoice-fields-for-mapping-in-quickbooks