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. In my case I will add Inventory ID field, which is also standard field but it works perfectly for custom fields as well.

On our first step we need to create an extension on default endpoint. To do this you just need to select default, click “Extend Endpoint” buttons and provide name for new one.

When you do so, new Endpoint will be created and it will be inherited from default one. You can see that all inherited entities will be marked with arrow. Custom entities will be with no mark.

So now you can add new screens and entities to your endpoint. I have created an entity for country screen.

You also can extend fields on any existing entity. I have selected Journal Entry screen, and have added a new row in the details grid.

If you check the services definition schema (WSDL schema), you will see that Acumatica merges all default and custom definitions into one schema.

That’s all you need. Now we can use Visual Studio to define our integration code.

Provided code sample:

class Program
{
       static void Main(string[] args)
       {
              DefaultSoapClient client = new DefaultSoapClient();
              client.Login("admin", "123", null, null, null);

              foreach (Country cntr in client.GetList(new Country(), false))
              {
                      Console.WriteLine(cntr.CountryID);
              }

              JournalTransaction batch = client.Get(new JournalTransaction()
              {
                      Module = new StringValue() { Value = "IN" },
                      BatchNumber = new StringSearch() { Condition = StringCondition.Contains, Value = "00000046" } 
              }) as JournalTransaction;

              Console.WriteLine(batch.BatchNumber.Value);
              foreach (JournalTransactionDetail tran in batch.Details)
              {
                      Console.WriteLine(tran.InventoryID);
              };
       }
}

Have a nice integration!

8 Replies to “Extending Contract-Based API Default Endpoint”

Leave a Reply

Your email address will not be published. Required fields are marked *