Business Central APIs and bound actions

Business Central APIs and bound actions

9. Oktober 2018

Business Central APIs and bound actions

I’ve written about the Business Central Connect API before and explained how you can use my ALRunner extension to create an API-enabled Azure Container Instance (ACI) and use it to do serverless API development. I have extended that a bit and will show you a quick walkthrough as well as a bit of background.


My ALRunner extension now has the following new capabilities:

A walkthrough of using the extension full circle (start from scratch, create an ACI, create and test the sample API client) is here, but be warned that it takes 5 minutes:


A bit about bound actions

As I have written about the other aspects already and now only brought it all to my extension, I just want to add a bit of background about bound actions: Before bound actions, you could read, create, update and delete data through OData / REST interfaces in Business Central, but there was no direct way to call custom code or specific actions like posting a journal. There were a couple of workarounds but bound actions are the actual solution as the allow you to define which actions on a page can be called through a REST call. Microsoft once more has done a good job explaining this here, so if you want to learn more about how to create your own bound actions, I would suggest to read it there. But Microsoft has also exposed a couple of bound actions in their Connect APIs which as far as I know is only sparsely documented. If you go to the Business Central API documentation and go through all services listed there, you will find a couple with bound actions, including posting journals, and I have used this for my generated sample client.

You might know that through SOAP WebServices it was previously possible to call custom code as well but REST WebServices really have become more widely used as they are a lot easier and resource friendly to use, so it was kind of annoying that you still had to go through SOAP in order to call your custom code. With the implementation of bound actions the Connect API and the OData services in Business Central in general have taken a huge step forward and made creating connect apps a lot easier!

Creating a sample client for your own backend

If you already have your Business Central instance up and running somewhere, you might not want to create an ACI just to get my sample client. For that you can just use the new action „ALRunner: Generate an API Client for Business Central“ and it will ask you for URL, username and password and then create the sample.