On previous post , i have shared on how to access Business Central API using AAD Authentication . Now we will continue to explore the API in BC. One of it is automation API related to extension handling. It Consist of :
- Get List of Extension
- Install/Uninstall Extension API
- Upload & Install Extension API
- View Extension Deployment Status
This API can be useful to create automation of Extension Deployment to BC Cloud. Let’s start to try it.
Get List of Extension
The format is like below where sandbox is your environment dan for the companies is the company id. You can get the Company ID by inspect company list page.
response will be like below :
Please take note the PackageId, next example we will try to uninstall SignaturePad extension.
For the Extensions parameter is the packageID from previous step and for the Bound action is Microsoft.NAV.uninstall to uninstall extension, to install you can use Microsoft.NAV.Install
Response will be 200 OK if successfull
From extension management , you will notice the status of your extension will be “not installed”. Unpublish your extension as well as next step we will try to upload and install.
Upload and Install Extension
Format will be like below :
What you need to take note is the header part :
For If-match for new extension put it as * and for existing extension you need to put the etag of current extension you are updating . etag you can get it from Get List extension API.
In the body don’t forget to select your .app file and if successful the response will be 204 No Content.
Next , you can view the status of your extension deployment using below