microsoft / navcontainerhelper

Official Microsoft repository for BcContainerHelper, a PowerShell module, which makes it easier to work with Business Central Containers on Docker.
MIT License
369 stars 239 forks source link

Need Help with Admin/Dev API Reference #3587

Open Andrei15193 opened 2 weeks ago

Andrei15193 commented 2 weeks ago

Describe the issue

Hi, I'm currently looking for ways to automate the build & publish process for a Business Central extension and I'm having trouble finding the admin/dev API reference. What I have found online points me to the admin web API that I do not know how to access.

More context, we are using on-prem instances of Business Central which we access using our internal IP addresses. They are mostly for development, it looks something like this: 192.0.0.10:8080/BCInstance1 to access the UI and we have a dev port for it as well which we use to download symbols/packages and publish the extension through the VS Code extension.

I managed to get around what the extension is doing up to publishing the extension by calling the dev(?) web API. To get the packages I perform get requests to 192.0.0.10:12345/BCInstance1/dev/packages?publisher=Microsoft&appName=System&VersionText=22.0.0.0&tenant=default. It works, it gets me the packages then I check the manifest for dependencies and eventually get everything I need.

I managed to replicate what AppHandling/Publish-NavContainerApp.ps1 is doing and publish the app to 192.0.0.10:12345/BCInstance1/dev/app using a post request with a multi-part payload.

The issue I keep running into is that there's hardly any documentation or reference for these endpoints and I was wondering if I'm simply missing it or there is a way I can get some documentation on the dev web API.

The reason I ended up calling the endpoints directly is because of authentication, we use user/password and windows authentication depending on the instance and I got the requests to work for user/password using basic authentication when calling the endpoint. For windows authentication or Entra ID is probably similar granted I get a token and set the authentication headers properly.

What I'm having trouble with now is getting the runtime version of an extension, unpublishing it and deleting it. I can't find and web API endpoints that I can call to do this, is it even possible?

We want to perform CI/CD in the end, to build and publish extensions to on-prem and cloud instances of business central from a pipeline.

My issues boil down to the following.

freddydk commented 2 weeks ago

A lot of questions, which isn't really related to Containers and BcContainerHelper, but I can answer one

The dev endpoint is not documented. Why not use the PowerShell cmdlets to install your extension?

You might want to look at https://www.alops.be/ - I strongly recommend people to use a managed DevOps solution instead of building their own.

Andrei15193 commented 2 weeks ago

Thanks for answering this, I'm just a bit lost with getting this to work after searching and trying a lot of things.

I had a quick look at https://www.alops.be/, it might work if we switch to Azure DevOps.

You mentioned PowerShell cmdlets, can you please give me a link to them? I've tried a few and couldn't get them to work, while others come with the BC installation (I think).