Acumatica
Tutorials
Video
ERP
API
Subscribe

Acumatica Integrations (API's) Part Three - Simple API Programming Example

February 3, 2020

First, we will create a project in Visual Studio to create the solution and the first project will be the simple UI.

Once we have done that, we will add 2nd project that will be our class library for Acumatica code will be filled in later but adding to project now.

Once class library is added we will add service reference which will point back to WSDL from the SOAP endpoint. We can get this out of Acumatica by selecting endpoint version and then hitting the view end point service button which will give us a web link. We can then paste into our service. I would then give it a name that makes sense.  Something like Acumatica end point and version number.  

Once created the web service open object browser and see all different entities that are part of it that pulled directly into our project. This will become the source model for Acumatica as we build our integration.  Next thing to do is to update our app config file to allow cookies and extend the amount of message size we are allowed.  If we are doing https we also need the security mode transport in there.  I will be taking this out as I am running this on a local environment.  Should note allow cookies flag to true is what allows us to stay logged in.  If you are getting an error that says 'not logged in' when sending statement through later, this is probably the root cause you don’t have it set in your app config file correctly.  

Next thing to do is create setting file to store log in information.  This includes:user, password, tenant, locale, and company. Use this so you don’t have to hard code them in the code itself.  

Next, we will dump the base class.  We could rename but visual studio has problems with dumping and renaming something. It is just easier to dump and then give it a name right off the bat.

Jumping right into operation:  Have a CSV file and Acumatica chart of accounts we will add an account to the list and create the 3 accounts programmatically.  Will show how this works then walk you through the code. Simple console interface.  Tell it to load files by using L command, it goes out and loads the 3 files.  We go back and look at our version of Acumatica and refresh, we see those were created just as they were in the file.  This is a very simple application that paves the groundwork for a more complex application later. Because we have the class library, I must have app config file pointing to both places.  If running simple UI without library, we wouldn't have to do that but it’s best practice to split it up.  

The first section is UI controller.  We are setting an output and waiting for an input then telling it to act depending on which movements are used.  This is easily replaceable.  If we look at back end code you can see login, log off statements as well as simple pool conversion.  All we are doing is creating list of entity called account and going through and parsing the file, pulling in data streams,splitting on the comma, and assigning those and mapping those to our Acumatica entity.  From there we can put in some error trapping and walk through each account and put in a simple put statement with the account soap client dot put account. That is really what does the bulk of the work.  This is the bit that is communicating with Acumatica is the soap client we created from our WSDL service.  That will go through and do the communication.  We will catch any error and then log off the system.  Very simple UI and program but can be very powerful.

View Other Videos in This Series

Get Access to our extended Educational Video Library

Thank you! Your message has been sent and one of our team members will reach out to you shortly.
Oops! Something went wrong while submitting the form.