Solved

Retrieve Labor Cost Rate via REST API

  • 8 November 2023
  • 8 replies
  • 141 views

Hi,

I’m currently working with a customer regarding their integration to retrieve Labor Cost Rate via REST API.

 

Does this API endpoint use pagination like Employees(entity)? Do you have any API documentation? 

icon

Best answer by RohitRattan88 8 November 2023, 17:40

View original

8 replies

Userlevel 7
Badge +4

@daryldiaday 

If you need to query Labor Rates(PM209900) screen, there seems to be a default endpoint for it.

See below:

Help: https://help.acumatica.com/(W(255))/Help?ScreenId=ShowWiki&pageid=6340cff3-4732-4231-9e42-5d1e5e65b5dd

Hi @RohitRattan88 ,

Thank you for the response.

Does the parameter $skip and $top work with this?

When trying to make a call to this endpoint, it does not limit the number of rows being shown as a response.

 

 

Userlevel 7
Badge +4

@daryldiaday not with this method. I dont think so. However, if you wish, you could create a Generic Inquiry, add your required fields to it, expose via oData and retrieve/$filter/$top/$skip on this:

Ref: https://help.acumatica.com/(W(259))/Help?ScreenId=ShowWiki&pageid=46d3beed-0faf-4908-b5f4-1c282a110c4d

Or if all data is contained in single DAC, you could try using oDataV4:

https://help.acumatica.com/(W(263))/Help?ScreenId=ShowWiki&pageid=642945d9-df36-429b-8784-0f1bcf0e5495

Userlevel 3
Badge

@RohitRattan88 My client is trying to write back to the Labor Rate screen in Acumatica via the API using Celigo. We are running into the issue where it is not inserting a new record but only updating the current line there for the particular Employee-Labor Items-Effective Date. Is there a trick to get it to always insert new record instead of overriding? 

Userlevel 7
Badge +4

@cshaheen26 

This is a inquiry screen with ability to add details rows. You could get header id using above mentioned example and then add a new detail entry on the details using header ID:

Before
POSTMAN Call
Result

 

@RohitRattan88 I am @cshaheen26 client. Appreciate the insight on this, it helped us realize we were structuring our call a little wrong. So I reformatted the json to the format you gave as an example and was able to get it to add a row when a row already exists. However this caused another little issue. In this record set we can have three scenarios:

  1. No existing Labor Rate exists
  2. A existing Labor Rate record exists with a different Effective Date
  3. An existing Labor Rate record exists with same Effective Date but a different rate. I think in this scenario we would want to modify the existing record, in fact if we try to add a record (in GUI) it will tell us the effective date already exists.

In scenario 1&2 we want to add a new record, which thanks to you we can now do. But now I cannot get it to modify the existing record (scenario 3). Here is a postman example of what I am sending:

PUT statement for Scenario 3
​​​​

Here is the error I am getting back:

{
    "message": "An error has occurred.",
    "exceptionMessage": "No entity satisfies the condition.",
    "exceptionType": "PX.Api.ContractBased.NoEntitySatisfiesTheConditionException",
    "stackTrace": "   at PX.Api.ContractBased.EntityService.DetermineEntityDescriptor(ISystemContract systemContract, String version, String name, EntityImpl entity, EntityExportContextBuilder entityExportContextBuilder, EntityDescriptor& entityDescriptor, PXGraph graph, CbOperationContext operationContext, Boolean& isArchived)\r\n   at PX.Api.ContractBased.EntityService.Put(ISystemContract systemContract, String version, String name, EntityImpl entity, CbOperationContext operationContext, Boolean throwOnError)\r\n   at PX.Api.ContractBased.Soap.SoapFacadeBase.PutImpl(EntityImpl entity, Boolean throwOnValidationError)\r\n   at PX.Api.ContractBased.SystemContracts.V2.RestController.PutEntity(EntityImpl entity, String select, String filter, String expand, String custom)\r\n   at lambda_method(Closure , Object , Object[] )\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass6_2.<GetExecutor>b__2(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__1.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__6.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__6.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__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.<CallOnActionExecutedAsync>d__6.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__6.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__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.Controllers.ActionFilterResult.<ExecuteAsync>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.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__3.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__6.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__6.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__15.MoveNext()"
}

 

Any thoughts on how to get this to work? We are using Celigo Integrator.io to run these commands if that matters. Thanks!

Userlevel 7
Badge +4

@canelick please pass the result record’s id to modify an existing record.

@canelick please pass the result record’s id to modify an existing record.

@RohitRattan88 Yep, I figured that out this morning and got it to update in Postman, but Celigo is still throwing that error. Pulling my hair out trying to figure out the differences.

FYI, I actually had to add the “note”: ”value”: “” object to get it to take the entry along with the recordID

Thanks for the help!

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