Dynamic API Endpoint URL

Hi All,Sometimes you may need to dynamically change the URL of the API endpoint. In these cases standard way with putting URL in app.config file does now work properly, so we need another way. Here I want to share with you one of the good options that I used in some API integrations here URL needs to be configured in the sessions screen: This approach also helped me previously to solve issue “Could not find endpoint element with name ‘<Name>’ and Contract ‘<Name>’ in the ServiceModel client configuration section. …” In general this error can be solved by copying app.config file with dll or embedding configurations, but it is much… Read more

Attach Files with Rest API

Hi All, In Addition to my topic with Acumatica REST API where I showed how to retrieve and save records using Acumatica Contract Base Rest API I want to share with you now how can you attach files with the same way. To Attach file you just need to put binary data by following URL: https://<server>/entity/<endpoint>/<version>/<entity>/<key1>/<key2>/files/<filename> For example, to attach file to stock item you will have following URL: http://acusea.acumatica.com/entity/Default/6.00.001/StockItem/AACOMPUT01/files/image.png File will be attached to entity automatically. Have a nice integration!

Getting Report PDF through Web Servies

Hi All, Today want to show you very simple example of getting printing report and getting it’s PDF representation thought Screen Based API. For doing this we need: Screen-based Endpoint to Report. Import Web services References to our project Fill report parameters using Value command. Request Report to be formatted as PDF (schema.ReportResults.PdfContent). Please note that you also can get a HTML representation of report. Receive report binary data from Acumatica using Submit command from Web Services. Save data somewhere. In my case i’m just saving report as a file to file system, but you can process it however you need. Full Code Sample: View the code on Gist. Have… Read more

Reuse Session during API Calls

Hi All, If you using Acumatica Web Services you most probably saw the examples where you need to call Login and GetSchema methods before each valuable operation. This is OK in general, but if you building some complex and high loaded integration as the result you may get something like this: Not very nice as it creates additional traffic network traffic and unnecessary load to server. Much better way is to cache Cookies and Schema on the client side and refresh it only if it was not in use for some period of time. Here I want to share with you an example where I create a new class inherited… Read more

Acumatica REST API

HI All, With Acumatica 6 release you can find (and actually use) new type of API – Rest API. Acumatica Rest API is based on Contract based API, so here you have some important points: You need to use existing or custom endpoint be able to send API calls Field and container is available for REST API only if it is defined in contract. But you may extend existing contracts. With REST API you have the same set of commands that you have with Contract Based API. Acumatica uses Json format for transfer data between client and server You still have to maintain session and authentication cookies. URL: http://<InstanceName>/entity/<EndpointName>/<EndpointVersion>/<Entity> Example:… Read more

Disable Discounts Calculation for API Calls

Hi All, When you creating a multiple AR/SO documents with multiple lines through the API, you may have a nice trick to little-bit optimize system performance. By default Acumatica business logic is optimized for entering data from UI, so all variables as taxes and discounts must be recalculated on each document line. But during bulk load you actually can do it just once – before document save. Here you have extension that will disable automatic discounts calculation if you loading data from API or Integration services. public class SOOrderEntryExtension : PXGraphExtension<SOOrderEntry> {        [PXOverride]        public virtual void RecalculateDiscounts(PXCache sender, SOLine line, Action<PXCache, SOLine> del)        {               if (!Base.IsImport)… Read more

Extending Contract-Based API Default Endpoint

Hi All! Today, I want to speak with you about Contract-Based Web Services API share with you new cool thing that is available in Acumatica 6 – Extensions of Contracts. Using this feature you can reuse of all benefits of default endpoint that Acumatica provides you out of the box and just extend it with adding couple of fields. OK, let me show you one simple example with 2 changes: Adding one more entity to default endpoint. In my case it will be Country screen. Country is a standard table but the same way you can add all custom screens as well. Adding one more column to Journal Transactions grid.… Read more

Publish customization through Web Services API

HI All, Today I want to share with you one new cool feature in latest 5.3 update of Acumatica. You may know that Acumatica has a special type of Web Services API –  Service Endpoint. This API is designed to work with Reports and Report Designer. In genera Report designer is a standalone win form application that communicates with acumatica using web services API. Also this API contains some really old ways of integration that are here just for compatibility purposes. URL for this services API is: https://<instance>/api/servicegate.asmx But starting from version 5.30.2126 it also can work with customization packages. Newly available methods: UploadPackage – helps you yo upload zip package to acumatica… Read more