Forum Discussion

mdaniels's avatar
mdaniels
Member
5 days ago

Interpret POST Purchase Order Errors

I do not understand the response below given the request. Does anybody know what is wrong with the request?

Sending a POST request https://api.myob.com/accountright/{id}/Purchase/Order/Servic with body:

 

{
    "UID": null,
    "OrderType": null,
    "Subtotal": null,
    "TotalTax": null,
    "TotalAmount": null,
    "Lines": [
        {
            "RowID": null,
            "Total": 613.4,
            "TotalForeign": null,
            "Account": {
                "Name": null,
                "DisplayID": null,
                "UID": "348cf54b-f6f2-4c10-bc0b-9793f0b9873c",
                "URI": null
            },
            "Job": {
                "Number": null,
                "Name": null,
                "UID": "1257e9f6-af16-41f8-9ca7-fa2ec29eb931",
                "URI": null
            },
            "TaxCode": {
                "Code": null,
                "UID": "90008f0b-c54f-4238-85da-5c4634f29dee",
                "URI": null
            },
            "Type": 0,
            "Description": "0124655507 - Alternator 24V 150A - Quantity: 1.0000000",
            "RowVersion": null
        },
        {
            "RowID": null,
            "Total": 19.9,
            "TotalForeign": null,
            "Account": {
                "Name": null,
                "DisplayID": null,
                "UID": "348cf54b-f6f2-4c10-bc0b-9793f0b9873c",
                "URI": null
            },
            "Job": {
                "Number": null,
                "Name": null,
                "UID": "1257e9f6-af16-41f8-9ca7-fa2ec29eb931",
                "URI": null
            },
            "TaxCode": {
                "Code": null,
                "UID": "90008f0b-c54f-4238-85da-5c4634f29dee",
                "URI": null
            },
            "Type": 0,
            "Description": "LV2929 - 7P Heavy Duty Socket J560 - Quantity: 1.0000000",
            "RowVersion": null
        },
        {
            "RowID": null,
            "Total": 197.75,
            "TotalForeign": null,
            "Account": {
                "Name": null,
                "DisplayID": null,
                "UID": "348cf54b-f6f2-4c10-bc0b-9793f0b9873c",
                "URI": null
            },
            "Job": {
                "Number": null,
                "Name": null,
                "UID": "1257e9f6-af16-41f8-9ca7-fa2ec29eb931",
                "URI": null
            },
            "TaxCode": {
                "Code": null,
                "UID": "90008f0b-c54f-4238-85da-5c4634f29dee",
                "URI": null
            },
            "Type": 0,
            "Description": "LV2932 - Suzi Coil 7 Core HD 4.6mm - Quantity: 1.0000000",
            "RowVersion": null
        }
    ],
    "Comment": "Raised by ___ ",
    "ShippingMethod": null,
    "PromisedDate": null,
    "OrderDeliveryStatus": 1,
    "SubtotalForeign": null,
    "FreightForeign": null,
    "TotalTaxForeign": null,
    "TotalAmountForeign": null,
    "AppliedToDateForeign": null,
    "BalanceDueAmountForeign": null,
    "Number": "200032",
    "Date": "2026-05-19T00:03:56.1445474+00:00",
    "SupplierInvoiceNumber": "",
    "Supplier": {
        "Name": null,
        "DisplayID": null,
        "UID": "8c8ad821-c70e-4ff1-9333-f8a5be29116a",
        "URI": null
    },
    "ShipToAddress": null,
    "Terms": null,
    "IsTaxInclusive": false,
    "IsReportable": false,
    "Freight": 40.0,
    "FreightTaxCode": {
        "Code": null,
        "UID": "90008f0b-c54f-4238-85da-5c4634f29dee",
        "URI": null
    },
    "Category": {
        "DisplayID": null,
        "Name": null,
        "UID": "25b8b8ed-8b52-43db-bbb1-3c3ad27d72b7",
        "URI": null
    },
    "JournalMemo": null,
    "AppliedToDate": 0,
    "BalanceDueAmount": 0,
    "Status": 0,
    "LastPaymentDate": null,
    "ForeignCurrency": null,
    "CurrencyExchangeRate": null,
    "URI": null,
    "RowVersion": null,
    "Created": null,
    "LastModified": null,
    "ETag": null
}

 

I get response:

{
    "Errors": [
        {
            "Name": "ValidationError",
            "Message": "BusinessLine_AccountRequired",
            "AdditionalDetails": "AccountId:(PurchaseOrderFreightLine)",
            "ErrorCode": 4253,
            "Severity": "Error",
            "LearnMore": null
        },
        {
            "Name": "ValidationWarning",
            "Message": "BusinessLine_JobRequired",
            "AdditionalDetails": "JobId:(PurchaseOrderFreightLine)",
            "ErrorCode": 4260,
            "Severity": "Warning",
            "LearnMore": null
        }
    ],
    "Information": "Warning, error messages have not been finalised in this release and may change"
}

1 Reply

  • Mike_James's avatar
    Mike_James
    Ultimate Cover User
    4 days ago

    Hi mdaniels​ , this link Service tells you which elements are mandatory. I suggest you only supply the UIDs for the various records (supplier, account, job, tax code etc), because the other fields in each group are read-only.

    The AccountID is an error, the JobRequired is a warning. Warnings won't stop the POST succeeding.

    I also think the subtotal, totaltax and totalamount values should be provided.