Updated Admin API Reference (markdown)

Stef Heyenrath
2025-05-02 14:56:54 +02:00
parent 9f3fa1e0ab
commit e1f7de9432

@@ -18,13 +18,50 @@ api.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64Strin
// OR
// Set Azure ADAuthorization
// Set Azure AD Authentication
api.Authorization = new AuthenticationHeaderValue("Bearer", "eyJ0eXAiOiJKV1QiLCJ...");
// Call API
var settings = await api.GetSettingsAsync();
```
## Azure AD Authentication - Information
To get v2.0 AAD token you need to modify the `Manifest` of your AAD app registration by following the instructions here https://docs.azure.cn/en-us/entra/identity-platform/scenario-protected-web-api-app-registration#accepted-token-version
You can then get the token using this CURL command
```bash
# replace AadClientId, AadApplicationURI, AadClientSecret, AadTenantId with the AAD details from the azure portal.
curl -X POST -H "Content-Type: application/x-www-form-urlencoded" -d 'client_id={AadClientId}&scope={AadApplication Uri}/.default&client_secret={AadClientSecret}&grant_type=client_credentials' 'https://login.microsoftonline.com/{AadTenantId}/oauth2/v2.0/token'
```
Once obtaining the token, start the WireMock.Net server, e.g. the `WireMock.Net.StandAlone` package.
```c#
using WireMock.Logging;
using WireMock.Net.StandAlone;
using WireMock.Settings;
var settings = new WireMockServerSettings
{
AllowPartialMapping=true,
Logger = new WireMockConsoleLogger(),
UseSSL = true,
AdminAzureADTenant = "AadTennatId",
AdminAzureADAudience = "AadAudience",
StartAdminInterface=true
};
StandAloneApp.Start(settings);
Console.WriteLine("Press any key to stop the server");
Console.ReadKey();
```
Make a `GET` request to `{WiremockServerURL}/__admin/requests` with the `Bearer AadToken` set in the `Authorization` header and 200 for success 401 for authentication errors.
### FluentBuilder
All Admin API Model classes are annotated with [FluentBuilder](https://github.com/StefH/FluentBuilder) which makes it easy to build a mapping in a fluent way.