Solved

Confirm Shipment API call

  • 20 March 2023
  • 5 replies
  • 162 views

     I am trying to figure out a way to update Fulfillment status and Confirm a shipment in one call instead of doing 2 separate calls, to get this approach working would it be difficult to extend the web service endpoints?
Do y’all have any better option or the best way to go is make multiple calls?

icon

Best answer by Yuriy Zaletskyy 21 March 2023, 15:58

View original

5 replies

Userlevel 5
Badge +3

You can check this repository:

https://github.com/Acumatica/AcumaticaRESTAPIClientForCSharp

And there is the sample of shipment confirmation:

				var configuration = authApi.LogIn(username, password, tenant, branch, locale);

Console.WriteLine("Reading Accounts...");
var accountApi = new AccountApi(configuration);
var accounts = accountApi.GetList(top: 5);
foreach (var account in accounts)
{
Console.WriteLine("Account Nbr: " + account.AccountCD.Value + ";");
}

Console.WriteLine("Reading Sales Order by Keys...");
var salesOrderApi = new SalesOrderApi(configuration);
var order = salesOrderApi.GetByKeys(new List<string>() { "SO", "SO005207" });
Console.WriteLine("Order Total: " + order.OrderTotal.Value);


var shipmentApi = new ShipmentApi(configuration);
var shipment = shipmentApi.GetByKeys(new List<string>() { "002805" });
Console.WriteLine("ConfirmShipment");
shipmentApi.WaitActionCompletion(shipmentApi.InvokeAction(new ConfirmShipment(shipment)));

in the file RESTExample.cs .

Userlevel 7
Badge +17

@Preethin  I see that you are trying to fetch the FinPeriod based on the dates.

We have a built-in functionality in Acumatica with the below code. I just checked and it is working fine.

Please check.

 

 Func<PXGraph, IFinPeriodRepository> factoryFunc = (Func<PXGraph, IFinPeriodRepository>)ServiceLocator.Current.GetService(typeof(Func<PXGraph, IFinPeriodRepository>));
IFinPeriodRepository service = factoryFunc(Base);
FinPeriod finPeriod = service.GetFinPeriodByDate(Base.Document.Current.OrderDate, FinPeriod.organizationID.MasterValue);

PXTrace.WriteInformation(finPeriod.FinPeriodID);

Hope this helps!!

Hi Yuriy and Naveen,

@Yuriy Zaletskyy: I am able to confirm shipment through a Rest API call however I am having to do another call to update the tracking details.
So when I get the update from a 3pl about the shipment status, I would like to take that to ACM and update the same in one PUT/POST call
Is that possible? @Naveen Boga 

I followed this to make the confirm shipment happen

 

Userlevel 5
Badge +3

@Preethin to put simply you can’t in one call. Reason for that is that shipment confirmation is executed in async manner. The only what you can achieve, is one line of code, which internally will have two API calls or even 3 API calls. 

  1. Call #1 will trigger execution of shipment confirmation
  2. Call #2 will validate if shipment was confirmed
  3. Call #3 will get shipment information

you can achieve syntactic sugar within one line of code, but behind the curtains two or three api call will be needed.

Thank you both for looking into this and helping me out, greatly appreciate this.

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