Solved

Issue creating a Bill via the API

  • 20 January 2023
  • 7 replies
  • 199 views

I’m attempting to create a Bill via the API - https://xxxxx.myobadvanced.com/entity/Default/20.200.001/Bill

{
"Entity": {
"Type": {
"value": "Bill"
},
"BranchID": {
"value": "MAIN"
},
"DueDate": {
"value": "2023/01/31T00:00:00+00:00"
},
"Vendor": {
"value": "14340"
},
"VendorRef": {
"value": "14340"
},
"LocationID": {
"value": "MAIN"
}
}
}

Response

{
"id": "60793d30-6698-ed11-ab3d-023a8f428f42",
"rowNumber": 1,
"note": null,
"error": "'VendorLocationID' cannot be empty.; 'VendorLocationID' cannot be empty.; VendorLocationID: 'VendorLocationID' cannot be empty.",
"Amount": {
"value": 0.0
},
"ApprovedForPayment": {
"value": false
},
"Balance": {
"value": 0.0
},
"CashAccount": {},
"CurrencyID": {
"value": "AUD"
},
"Date": {
"value": "2023-01-20T00:00:00+00:00"
},
"Description": {},
"DueDate": {
"error": "'Due Date' cannot be empty."
},
"Hold": {
"value": false
},
"LastModifiedDateTime": {
"value": "2023-01-20T02:00:19.8832635+00:00"
},
"PostPeriod": {
"value": "072023"
},
"ReferenceNbr": {
"value": "<NEW>"
},
"Status": {
"value": "Balanced"
},
"TaxTotal": {
"value": 0.0
},
"Terms": {
"error": "'Terms' cannot be empty."
},
"Type": {
"value": "Bill"
},
"Vendor": {
"error": "'Vendor' cannot be empty."
},
"VendorRef": {
"error": "'Vendor Ref.' cannot be empty."
},
"custom": {}
}

Questions:

  1. Why am I seeing an error for DueDate, Terms, Vendor and VendorRef when the request has a value?
  2. What is VendorLocationID referring to on a Bill? It’s not defined in Swagger and doesn’t seem to be visible in the Bill UI.
icon

Best answer by anthonykeller79 23 January 2023, 12:33

View original

7 replies

Userlevel 5
Badge +1

Hi @anthonykeller79 

  1. Please find an example of Bill creation below:
    PUT: {sitename}/entity/Default/20.200.001/Bill
{
"Type": {
"value": "Bill"
},
"BranchID": {
"value": "PRODWHOLE"
},
"DueDate": {
"value": "2023-01-31"
},
"Terms": {
"value": "30D"
},
"Vendor": {
"value": "AAVENDOR"
},
"VendorRef": {
"value": "14340"
},
"LocationID": {
"value": "MAIN"
},
"PostPeriod": {
"value": "12-2022"
}
}
  1. Please make sure that the data which you are passing in request body exists in the instance. You can check this by creating a bill with same values in the UI.
  2. Other related examples for creating a bill can be found here:
    https://help-2022r2.acumatica.com/(W(6))/Help?ScreenId=ShowWiki&pageid=74a426d9-d4f7-4005-ba45-d88817d62dff

Thanks @ruchikasharma23   

The request I’m trying uses values taken from a GET request of an existing bill. Do you know why I’m seeing errors about missing values that are clearly being passed in the request?

Userlevel 7
Badge +5

It does seem like the Vendor value is not set, and thus all the dependent values are failing to be set as well. 

Please check if the Vendor that you are trying to create the bill for 1) present in the system,  2) active, and 3) accessible for the user you use to log in to API.

  1. I can confirm that the vendor is present in the system.
  1. I can confirm that the vendor/supplier is active
  1. The API user has Admin rights

I am able to create a bill via the UI using the same values (but with a different user).

Working through step by step

{
"Entity": {
"Type": {
"value": "Bill"
}
}
}

returns

{
"id": "772ec9e4-0e9b-ed11-ab3d-023a8f428f42",
"rowNumber": 1,
"note": null,
"error": "'VendorLocationID' cannot be empty.; 'VendorLocationID' cannot be empty.; VendorLocationID: 'VendorLocationID' cannot be empty.",
"Amount": {
"value": 0.0
},
"ApprovedForPayment": {
"value": false
},
"Balance": {
"value": 0.0
},
"CashAccount": {},
"CurrencyID": {
"value": "AUD"
},
"Date": {
"value": "2023-01-23T00:00:00+00:00"
},
"Description": {},
"DueDate": {
"error": "'Due Date' cannot be empty."
},
"Hold": {
"value": false
},
"LastModifiedDateTime": {
"value": "2023-01-23T11:13:00.7314232+00:00"
},
"PostPeriod": {
"value": "072023"
},
"ReferenceNbr": {
"value": "<NEW>"
},
"Status": {
"value": "Balanced"
},
"TaxTotal": {
"value": 0.0
},
"Terms": {
"error": "'Terms' cannot be empty."
},
"Type": {
"value": "Bill"
},
"Vendor": {
"error": "'Vendor' cannot be empty."
},
"VendorRef": {
"error": "'Vendor Ref.' cannot be empty."
},
"custom": {}
}

This indicates to me that a number of values are defaults.

Adding the “Vendor” parameter

{
"Entity": {
"Type": {
"value": "Bill"
},
"Vendor": {
"value": "14340"
}
}
}

returns an identical response:

{
"id": "bcbfcc3b-0f9b-ed11-ab3d-023a8f428f42",
"rowNumber": 1,
"note": null,
"error": "'VendorLocationID' cannot be empty.; 'VendorLocationID' cannot be empty.; VendorLocationID: 'VendorLocationID' cannot be empty.",
"Amount": {
"value": 0.0
},
"ApprovedForPayment": {
"value": false
},
"Balance": {
"value": 0.0
},
"CashAccount": {},
"CurrencyID": {
"value": "AUD"
},
"Date": {
"value": "2023-01-23T00:00:00+00:00"
},
"Description": {},
"DueDate": {
"error": "'Due Date' cannot be empty."
},
"Hold": {
"value": false
},
"LastModifiedDateTime": {
"value": "2023-01-23T11:15:26.4367564+00:00"
},
"PostPeriod": {
"value": "072023"
},
"ReferenceNbr": {
"value": "<NEW>"
},
"Status": {
"value": "Balanced"
},
"TaxTotal": {
"value": 0.0
},
"Terms": {
"error": "'Terms' cannot be empty."
},
"Type": {
"value": "Bill"
},
"Vendor": {
"error": "'Vendor' cannot be empty."
},
"VendorRef": {
"error": "'Vendor Ref.' cannot be empty."
},
"custom": {}
}

 

Using the Vendor API

https://xxxxxxxx.myobadvanced.com/entity/Default/20.200.001/Vendor?$top=5&$filter=VendorID eq '14340'

I get this response

[
{
"id": "<redacted>",
"rowNumber": 1,
"note": {
"value": ""
},
"AccountRef": {},
"APAccount": {
"value": "200100"
},
"APSubaccount": {
"value": "00"
},
"CashAccount": {
"value": "100010"
},
"CreatedDateTime": {
"value": "2020-12-17T22:38:59.441956+00:00"
},
"CurrencyID": {
"value": "AUD"
},
"CurrencyRateType": {
"value": "SPOT"
},
"EnableCurrencyOverride": {
"value": true
},
"EnableRateOverride": {
"value": true
},
"FOBPoint": {},
"LandedCostVendor": {
"value": false
},
"LastModifiedDateTime": {
"value": "2022-07-25T03:39:12.832013+00:00"
},
"LeadTimedays": {},
"LocationName": {
"value": "Primary Location"
},
"MaxReceipt": {
"value": 100.000000
},
"MinReceipt": {
"value": 0.000000
},
"ParentAccount": {},
"PaymentBy": {
"value": "Due Date"
},
"PaymentLeadTimedays": {
"value": 0
},
"PaymentMethod": {
"value": "EFT"
},
"PaySeparately": {
"value": false
},
"PrintOrders": {
"value": false
},
"ReceiptAction": {
"value": "Accept but Warn"
},
"RemittanceAddressOverride": {},
"RemittanceContactOverride": {},
"SendOrdersbyEmail": {
"value": false
},
"ShippingAddressOverride": {},
"ShippingContactOverride": {},
"ShippingTerms": {},
"ShipVia": {},
"Status": {
"value": "Active"
},
"TaxCalculationMode": {
"value": "Tax Settings"
},
"TaxRegistrationID": {},
"TaxZone": {
"value": "DOMESTIC"
},
"Terms": {
"value": "NET14DAYS"
},
"ThresholdReceipt": {
"value": 100.000000
},
"VendorClass": {
"value": "VENDDFT"
},
"VendorID": {
"value": "14340"
},
"VendorIsLaborUnion": {
"value": false
},
"VendorIsTaxAgency": {
"value": false
},
"VendorName": {
"value": "<redacted>"
},
"custom": {}
}
]

 

I’m not sure what else to try - everything seems okay to me. I’m obviously getting something wrong - this is my first integration so I don’t really know where to go from here.

I found the issue…

The “Bill" was nested in an “Entity” field - I removed that and it worked.

{
"Type": {
"value": "Bill"
},
"LocationID": {
"value": "MAIN"
},
"Vendor": {
"value": "14340"
},
"VendorRef": {
"value": "Ref123456"
},
"Hold":{
"value": true
}
}

Completely my fault - saw “entity” in the swagger and assumed it was a field name.

 

Userlevel 7
Badge

Thank you for sharing your solution with the community @anthonykeller79 !

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved