Custom API: Enumerating Installed Apps in Business Central On-Premises

 Below is the API code:

page 50100 "My Installed Apps API"
{
    APIGroup = 'app1';
    APIPublisher = 'ivansingleton';
    APIVersion = 'v1.0';
    ApplicationArea = All;
    DelayedInsert = true;
    EntityName = 'InstalledApp';
    EntitySetName = 'InstalledApps';
    PageType = API;
    SourceTable = "NAV App Installed App";
    ODataKeyFields = "App ID";

    layout
    {
        area(content)
        {
            repeater(General)
            {
                field(appID; Rec."App ID")
                {
                    Caption = 'App ID';
                }
                field(packageID; Rec."Package ID")
                {
                    Caption = 'Package ID';
                }
                field(name; Rec.Name)
                {
                    Caption = 'Name';
                }
                field(publisher; Rec.Publisher)
                {
                    Caption = 'Publisher';
                }
                field(versionMajor; Rec."Version Major")
                {
                    Caption = 'Version Major';
                }
                field(versionMinor; Rec."Version Minor")
                {
                    Caption = 'Version Minor';
                }
                field(versionBuild; Rec."Version Build")
                {
                    Caption = 'Version Build';
                }
                field(versionRevision; Rec."Version Revision")
                {
                    Caption = 'Version Revision';
                }
                field(publishedAs; Rec."Published As")
                {
                    Caption = 'Published As';
                }
            }
        }
    }
}

Using API in Postman

The Custom API built works for both versions of Business Central On-Premises/On Cloud, and below I will show examples of how to make the requests.

In the case of On-Premises I am using Basic Authentication, in the case of On Cloud, AOuth2, of latter I leave more information on how to connect in this previous post.

On Premises:

Using API in Postman

The Custom API built works for both versions of Business Central On-Premises/On Cloud, and below I will show examples of how to make the requests.

In the case of On-Premises I am using Basic Authentication, in the case of On Cloud, AOuth2, of latter I leave more information on how to connect in this previous post.

On Premises:

HTTP REQUEST
http://<URL base>:<Port>/<Instance>/api/<APIPublisher>/<APIGroup>/<APIVersion>/companies(aaaaaaaca-bbbb-ccc-dddd-000eeeeeee7)/<EntitySetName>
EXAMPLE:
http://200.xx.xxx.xxx:7048/BC220/api/ivansingleton/app1/v1.0/companies(aaaaaaaca-bbbb-ccc-dddd-000eeeeeee7)/InstalledApps
POSTMAN

On Cloud:

Although the title of the post mentions Business Central On-Premises, I want to take advantage of the Post to show how the call would be implemented in the On Cloud version.

HTTP REQUEST
https://api.businesscentral.dynamics.com/v2.0/<EnviromentName>/api/<APIPublisher>/<APIGroup>/<APIVersion>/companies(aaaaaaaca-bbbb-ccc-dddd-000eeeeeee7)/<EntitySetName>
EXAMPLE
https://api.businesscentral.dynamics.com/v2.0/Sandbox/api/ivansingleton/app1/v1.0/companies(aaaaaaaca-bbbb-ccc-dddd-000eeeeeee7)/InstalledApps
POSTMAN

Getting the list of Extensions natively

Finally, I show how to do it natively in the On Cloud version using Automation APIs.

Here I tried to do the same in the On-Premises version but I had no success, I did not find information on the internet either and that is where if someone knows how to do it I would like you to let me know. (I think that maybe if the credentials are approved to be used with AAD it could work)

HTTP request

GET /microsoft/automation/v2.0/companies({companyid})/extensions

Example

https://api.businesscentral.dynamics.com/v2.0/<Your-Tenant-Id>/<Enviroment-Name>/api/microsoft/automation/v2.0/companies(aaaaaaaca-bbbb-ccc-dddd-000eeeeeee7)/extensions

No comments:

Post a Comment