Skip to main content
Question

REST API - 500 error creating a Bill

  • July 19, 2021
  • 0 replies
  • 399 views

Hello,

Maybe related to a problem I posted earlier about not being able retrieve a bill created in the Acumatica 2020/R1 gui:

I tried to create a bill with the Contract-Based REST API, based on an http request in the integration guide:

PUT https://acumatica-dev.psfc.coop/entity/Default/18.200.001/Bill?$select=ReferenceNbr,Details/POOrderNbr,Details/POOrderNbr,Details/InventoryID,Details/Qty&$expand=Details

body:

{
    "Vendor": {
        "value": "V100958"
    },
    "VendorRef": {
        "value": "123"
    },
    "Description": {
        "value": "Bill for particular lines of a purchase order"
    },
    "Details": [
        {
            "POOrderType":
            {
                "value": "Normal"
            },
            "POOrderNbr":
            {
                "value": "000001"
            },
            "POLine":
            {
                "value": 1
            },
            "Qty":
            {
                "value": 5
            }
        }
    ]
}

I get a 500 response and this body (edited):

{
    "message": "An error has occurred.",
    "exceptionMessage": "Operation failed",
    "exceptionType": "PX.Data.PXInvalidOperationException",
    "stackTrace": "   at PX.Api.ContractBased.EntityService.Put(ISystemContract systemContract, String version, String name, EntityImpl entity, CbOperationContext operationContext, Boolean throwOnError)...<edited for brevity>",
    "innerException": {
        "message": "An error has occurred.",
        "exceptionMessage": "Exception has been thrown by the target of an invocation.",
        "exceptionType": "System.Reflection.TargetInvocationException",
        "stackTrace": "   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)\r\n   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)\r\n   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)\r\n   at PX.Api.ContractBased.EntityExportContextBuilder.<>c__DisplayClass87_1.<FindImplementations>b__3(PXGraph graph, EntityImpl entity, EntityImpl targetEntity)\r\n   at PX.Api.SyImportProcessor.SyStep.ProcessCommand(SyCommand cmd, Boolean& needCommit)\r\n   at PX.Api.SyImportProcessor.ExportTableHelper.ExportTable()",
        "innerException": {
            "message": "An error has occurred.",
            "exceptionMessage": "Object reference not set to an instance of an object.",
            "exceptionType": "System.NullReferenceException",
            "stackTrace": "   at PX.Objects.EndpointAdapters.DefaultEndpointImpl18.AddPOOrderLineToBill(PXGraph graph, APInvoiceEntry invoiceEntry, EntityValueField orderType, EntityValueField orderNbr, EntityValueField orderLineNbr)\r\n   at PX.Objects.EndpointAdapters.DefaultEndpointImpl18.BillDetail_Insert(PXGraph graph, EntityImpl entity, EntityImpl targetEntity)"
        }
    }
}

Can anyone please help me with this?