В настоящее время я провожу некоторые тесты с использованием Postman с Acumatica REST Api. Я пытаюсь создать заказ на продажу, используя запрос PUT к конечной точке заказа на продажу. Я могу сказать, что достигаю нужной конечной точки и начинаю создавать заказ на продажу, но я получаю сообщение об ошибке, что подэлемент не может быть пустым, даже если я пытаюсь передать ему значение. Вот тело моего запроса PUT:
{
"OrderType" : {value: "QT"},
"CustomerID" : {value: 300000014},
"Details" :
[
{
"InventoryID" : {"value" : "001"},
"Subitem" : {"value" : "U"},
"Quantity": {"value" : 1}
},
{
"InventoryID" : {"value" : "002"},
"Subitem" : {"value" : "U"},
"Quantity": {"value" : 3}
}
]
}
И это ошибка, которую я получаю:
{
"message": "An error has occurred.",
"exceptionMessage": "PX.Data.PXException: Error: 'Subitem' cannot be empty.\r\n ---> PX.Data.PXOuterException: Error: Inserting 'Sales Order Line' record raised at least one error. Please review the errors.\r\n at PX.Data.PXUIFieldAttribute.CommandPreparing(PXCache sender, PXCommandPreparingEventArgs e)\r\n at PX.Data.PXCache.OnCommandPreparing(String name, Object row, Object value, PXDBOperation operation, Type table, FieldDescription& description)\r\n at PX.Data.PXCache`1.PersistInserted(Object row)\r\n at PX.Data.PXCache`1.Persist(PXDBOperation operation)\r\n at PX.Data.PXGraph.Persist(Type cacheType, PXDBOperation operation)\r\n at PX.Data.PXGraph.Persist()\r\n at PX.Objects.SO.SOOrderEntry.Persist()\r\n at SuperiorText.SOOrderEntryExt.Persist(PersistDelegate baseMethod) in C:\\Users\\csilva\\Source\\Repos\\SuperiorText\\SuperiorText\\SOOrderEntryExt.cs:line 23\r\n at PX.Data.PXSave`1.<Handler>d__2.MoveNext()\r\n at PX.Data.PXAction`1.<Press>d__31.MoveNext()\r\n at PX.Data.PXAction`1.<Press>d__31.MoveNext()\r\n at PX.Api.SyImportProcessor.SyStep.a(Object A_0, PXFilterRow[] A_1, PXFilterRow[] A_2)\r\n at PX.Api.SyImportProcessor.ExportTableHelper.ExportTable()\r\n --- End of inner exception stack trace ---",
"exceptionType": "PX.Api.ContractBased.OutcomeEntityHasErrorsException",
"stackTrace": " at PX.Api.ContractBased.EntityService.GetOperationResult(EntityImpl entity, EntityExportContextBuilder entityExportContextBuilder, PXSYTable exportedKeys, List`1 errors)\r\n at PX.Api.ContractBased.EntityService.Put(ISystemContract systemContract, String version, String name, EntityImpl entity, CbOperationContext operationContext)\r\n at PX.Api.ContractBased.Soap.EntityGateBase.PutImpl(EntityImpl entity)\r\n at lambda_method(Closure , Object , Object[] )\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters)\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()"
}
Я пробовал варианты как ключа подпункта (например, «Subitem», «SubItemID» и «Variant»), так и пробовал в качестве значения целые числа и строки (например, «U», 0). Мне пока не повезло.
Как правильно настроить таргетинг и назначить значение подэлемента для позиции в заказе клиента? А также, есть ли хорошая документация для этого где-нибудь? Те, с которыми я сталкивался до сих пор, не были достаточно полными в этом отношении.