Forum Discussion

nkm's avatar
nkm
Experienced User
4 years ago

Request body to create item invoices

Hi,

I am trying to create item invoices. The item invoice body from https://developer.myob.com/api/accountright/v2/sale/invoice/invoice_item/ , seems to have different fields from the Postman collection request body. The request body for the Postman collection seems to have fields such as BillQuantity, which is not in the item invoice body stated in the documentation. So the correct request body to follow is the one that is stated on the API documentation?

{
	"Number": "PSMN002",
	"Date": "2018-09-02T00:00:00",
	"SupplierInvoiceNumber": null,
	"Customer": {
		"UID": "dde4659b-7bb3-4ef7-9312-c13b2fa02f58"
	},
	"ShipToAddress": "Postman Sample, Address, Here",
	"Terms": { 
		"PaymentIsDue": "DayOfMonthAfterEOM",
		"DiscountDate": 1,
		"BalanceDueDate": 30,
		"DiscountForEarlyPayment": 0,
		"MonthlyChargeForLatePayment": 0,
		"DiscountExpiryDate": "2018-09-21T00:00:00",
		"Discount": 0,
		"DueDate": "2018-10-02T00:00:00"
	},
	"IsTaxInclusive": false,
	"IsReportable": false,
	"Lines": [{
		"Type": "Transaction",
		"Description": "Iten 123",
		"BillQuantity": 100,
		"ReceivedQuantity": 100,
		"BackorderQuantity": 0,
		"Total": 1000,
		"UnitPrice": 10,
		"Job": null,
		"DiscountPercent": 0,
		"TaxCode": {
			"UID": "3bd2fbea-54d7-4115-8030-b84360048465"
		},
		"Item": {
			"UID": "fed621c4-9e1b-4afa-a9f0-d7a85d0557bf"
		}
	}],
	"Subtotal": 1000,
	"Freight": 0,
	"FreightTaxCode": {
		"UID": "e4b03cbc-a1aa-4fe0-92a2-bc34530e1fc3"
	},
	"TotalTax": 100,
	"TotalAmount": 1100,
	"Category": null,
	"Comment": "",
	"ShippingMethod": null,
	"PromisedDate": null,
	"JournalMemo": "Purchase; 786",
	"BillDeliveryStatus": "Print",
	"AppliedToDate": 0,
	"BalanceDueAmount": 1100,
	"Status": "Open",
	"LastPaymentDate": null,
	"Order": null,
	"ForeignCurrency": null
}

 

  • The_Doc's avatar
    The_Doc
    Ultimate Cover User

    Hi nkm 

     

    Though I followed the Postman collection in working this all out in the early days - once I got my code working I didn't use Postman - just didn't need it.

     

    Yes there appears to be discrepancies and differences - small - your best bet - well it worked for me was to capture an item invoice directly from MYOB in JSON format - then use that as a template - it is trial and error.

     

    The Doc