Implementing a Sample ConfigMgr Web API

The following steps get you a working WebAPI that can show data retrieved from a ConfigMgr database. The project is hosted at


You need remote TCP Connectivity to the ConfigMgr database. (probably port 1433 )

Implementing a simple yet awesome ConfigMgr Web API.

Clone the repository

From PowerShell or commadn prompt run:

git clone

This will create a folder named CMWebAPI containing all the source code.

Open the folder in VS Code. Let the C# extension do it’s thing for a moment. The extension will configure itself whenever it finds an appsettings.json in the folder.

Open AppSettings.json and change the Database connection string to match your environment.

Press F5 to start the debugger! Your new shiny ConfigMgr webAPI is now live.

Tester / Example PowerShell Script

param (

if($AppName -ne $null)
    $url = "$apiURL/dpjson/$($DP)?appname=$AppName"

    $url =  "$apiURL/dpjson/$($DP)"  

Write-Verbose $url
Write-Output (Invoke-WebRequest -uri $url | ConvertFrom-Json)

Example URLs

All Applications.


All Applications on a DP with 01 in it’s hostname. http://localhost:5000/cmapplication/dp/01

All Applications on Specific DP (JSON)


Applications with “mic” in name on specific DP.


Application with “mic” in name on specific DP (JSON).



JSON Output


Non-JSON output


Happy automating. 🙂