Connect to Acumatica REST API with Power Automate

Share on facebook
Facebook
Share on twitter
Twitter
Share on linkedin
LinkedIn
Power Automate

Power Automate – Connecting to the Acumatica REST API

Are you an avid Power Automate User looking to connect to Acumatica but ran into roadblocks creating a Power Automate Custom Connector? Or starting anew and looking for some guidance?  You are not alone!

The answer to this topic has been somewhat elusive. So, we felt it would be good to share this to anyone looking to get up and running quickly.  Acumatica hasn’t recently published specific steps on how to authenticate with Power Automate and Microsoft disabled some functionality a few years ago that may have you ready to pull your hair out.

First off, create your Power Automate Flow that we are going to use.  We will make this extremely simple for the example.  We will have the following actions in this flow:

  • LOGIN – HTTP GET
  • Parse JSON – Parse out the Access_Code for future use.
  • GET – Go after the details that we are looking for.
  • LOGOUT – Making sure that we do the logout routine. If we don’t, we leave an API user open and could cause problems.

Acumatica Pre Work:

 We need to obtain authorization details so that we can connect to our Acumatica Tenant.  The method to do this is to create a Connected Application in Acumatica.  The process is simple:

Acumatica Connected Application

  1. Within your Acumatica Tenant, go to Connected Applications.
  2. Select “+” to create a new application.
  3. Give this Connected Application a Client Name that is recognizable.
  4. For OAuth 2.0 Flow, choose: Resource Owner Password Credentials
  5. Create the secret by choosing Add Shared Secret button.
  6. Give the secret a description and expiration date.
  7. Store the Secret in a secure place as you cannot retrieve this value after pressing OK.
  8. Once you press OK on the “Add Shared Secret” window, make sure to save the Connected Application.

Now that we have created our Connected Application, we can start setting up our Flow. At a high level, our FLOW will have a visual of the following:

Power Automate Flow

The first step we will dig into is the LOGIN. In this step, using Oauth authentication, we need to have the following parameters available.  This will require us to have setup a Connected Application within Acumatica which was explained above:

Client_ID – @   Example:  C3DBAC00-10E5-4C11-B95D-A984F9655C2A@SweetLife

Client_Secret – -> This is the Secret we saved from the Connected Application.  Example -> YYlf5y9BcuCcoLxsn6FDwg

Tenant – -> Login Name of the Tenant you are connecting to.  This will be found in the Tenants Screen.  Example -> SweetLife

Username – -> This will be a User that has API access to the Tenant

Password – -> Password for the User.

These items above will be used in the following code that will be placed into the Body of the HTTP GET request:

grant_type=password&client_id=@&client_secret=&username=&password=&scope=api

This detail will be placed in the body of the HTTP Request, which in this HTTP POST example I have named Login:

Acumatica Power Automate GEt

Once you have completed the Login action, you are good to move on to the next action.

PARSE JSON to get Access_Token for GET Request:

The next step in the flow will be to parse out the Access_Code from the previous actions output.  We do this in the following method:

  1. Create a Parse JSON Action
  2. Add the Login Body to the Content
  3. Click the “Generate from sample” for Schema and enter in the following details and click done.
  4. Schema that we will use as a sample:

{
“access_token”: “”,
“expires_in”: 3600,
“token_type”: “Bearer”,
“scope”: “api”
}

Note: Make sure the JSON you get looks like the above with four lines and not the other larger JSON output.

This is all that we need to do to capture the Access_Token that we will use in the next step.

Power Automate Generate Sample Schema

GET Request – in this action, we will be passing the Access Token that is returned to us in the Parse JSON Action.  Here are the steps to achieve this:

  1. Create a HTTP GET Action
  2. URI will be the URI of the endpoint you want to go after, for example:  https://tenantdomain/tenantname/entity/Default/17.200.001/Vendor
  3. Under Headers, we should have the following:Power Automate Bearer

This is all that is required to run a HTTP GET action.

Power Automate GET

Logout VERY Important, do not forget to add this step as you may run into login issues due to using up all your API sessions.

  1. Create an HTTP POST Request
  2. URI:  https://domainoftenant/tenantname/entity/logout
  3. Under the Headers section, you will have the same at the previous.

Acumatica Logout

Overall, this is a simple process but when it’s not documented it can take time.  We hope that this helps you shortcut your journey to using Power Automate to leverage the flexibility of the Acumatica platform.  Please reach out to our team for any help or questions.

Share this post

Share on facebook
Share on twitter
Share on linkedin
by Najaxa Software

by Najaxa Software

Keep Reading

Power Automate
Scroll to Top