Management of Account Groups

If you are using the contract-based REST API to integrate MYOB Acumatica with external systems, these external systems can create, modify, and remove account groups. For more information about account groups, see Account Groups: General Information.

The AccountGroup entity supports the creation, retrieval, update, and removal of the entity itself; however, you cannot modify the list of accounts of a particular account group by using the AccountGroup entity. Instead, you have to use the AccountGroup property in the Account entity. You can use the DefaultAccountID property of the AccountGroup entity to specify the default account for the group.
Note:
The removal of the default account from the group does not cause the DefaultAccountID property to be updated automatically. If you remove the default account from the group, you have to update the DefaultAccountID property.

Testing of the Requests

Before you test the code below, you need to configure your client application and the MYOB Acumatica instance to be used as follows:
  1. Deploy a new MYOB Acumatica instance with the U100 dataset. For details on deploying an instance, see To Deploy an MYOB Acumatica Instance.
  2. On the Enable/Disable Features (CS100000) form, make sure the Projects feature is enabled.
  3. To sign in to the instance in the client application, use the tenant name (which you specified when you created the instance) and the HEADOFFICE branch.
  4. If you use Postman as the client application for testing, in the IntegrationDevelopmentGuide.postman_collection.json collection (which is located in the IntegrationDevelopment\Help folder of the Help-and-Training-Examples repository on GitHub), make sure the collection variables have the proper values.
Tip:
In the request examples below, <MYOB Acumatica instance URL> is the URL of the MYOB Acumatica instance (such as https://my.acumatica.com/MyInstance). You can omit the instance name in the URL (such as https://my.acumatica.com) if the instance is installed in the root of the website.

Step 1: Create an Account Group

You start by creating an account group with the ACCG02 identifier, as shown in the following code.

PUT / HTTP/1.1
Host: [<MYOB Acumatica instance URL>]/entity/Default/23.200.001/AccountGroup
Accept: application/json
Content-Type: application/json

{
  "AccountGroupID" : {"value" : "ACCG02"},
  "Description" : {"value" : "Test Account Group"}
}

Step 2: Add Accounts to the Account Group

Now you need to add accounts to the account group. You add the 40000 account to the ACCG02 account group as follows.

PUT / HTTP/1.1
Host: [<MYOB Acumatica instance URL>]/entity/Default/23.200.001/Account
Accept: application/json
Content-Type: application/json

{
  "AccountCD" : {"value" : "40000"},
  "AccountGroup" : {"value" : "ACCG02"}
}

Next, you add the 40010 account to the ACCG02 account group, as shown in the following code.

PUT / HTTP/1.1
Host: [<MYOB Acumatica instance URL>]/entity/Default/23.200.001/Account
Accept: application/json
Content-Type: application/json

{
    "AccountCD" : {"value" : "40010"},
    "AccountGroup" : {"value" : "ACCG02"}
}

Step 3: Specify the Default Account of the Account Group

You need to specify the 40000 account as the default account of the ACCG02 account group, as shown in the following code example.

PUT / HTTP/1.1
Host: [<MYOB Acumatica instance URL>]/entity/Default/23.200.001/AccountGroup
Accept: application/json
Content-Type: application/json

{
  "DefaultAccountID" : {"value" : "40000"},
  "AccountGroupID" : {"value" : "ACCG02"}
}

Step 4: Retrieve the List of Accounts of the Account Group

You need to obtain the list of accounts of the ACCG02 account group as follows.

GET ?$filter=AccountGroup%20eq%20'ACCG02'&$select=AccountCD HTTP/1.1
Host: [<MYOB Acumatica instance URL>]/entity/Default/23.200.001/Account
Accept: application/json
Content-Type: application/json

Step 5: Remove an Account from the Group

Finally, you remove the 40010 account from the ACCG02 account group, as shown in the following code.

PUT / HTTP/1.1
Host: [<MYOB Acumatica instance URL>]/entity/Default/23.200.001/Account
Accept: application/json
Content-Type: application/json

{
  "AccountCD" : {"value" : "40010"},
  "AccountGroup" : {"value" : null}
}