PINGWorks.SitecoreExperienceEdge.AdminSDK
2.2.0
dotnet add package PINGWorks.SitecoreExperienceEdge.AdminSDK --version 2.2.0
NuGet\Install-Package PINGWorks.SitecoreExperienceEdge.AdminSDK -Version 2.2.0
<PackageReference Include="PINGWorks.SitecoreExperienceEdge.AdminSDK" Version="2.2.0" />
<PackageVersion Include="PINGWorks.SitecoreExperienceEdge.AdminSDK" Version="2.2.0" />
<PackageReference Include="PINGWorks.SitecoreExperienceEdge.AdminSDK" />
paket add PINGWorks.SitecoreExperienceEdge.AdminSDK --version 2.2.0
#r "nuget: PINGWorks.SitecoreExperienceEdge.AdminSDK, 2.2.0"
#:package PINGWorks.SitecoreExperienceEdge.AdminSDK@2.2.0
#addin nuget:?package=PINGWorks.SitecoreExperienceEdge.AdminSDK&version=2.2.0
#tool nuget:?package=PINGWorks.SitecoreExperienceEdge.AdminSDK&version=2.2.0
PINGWorks.SitecoreExperienceEdge.AdminSDK
This is a .NET SDK for working with Sitecore's Experience Edge Admin API.<br /> More information about Sitecore's API is at Admin API Doc (official)
Features
- Typed, DI-friendly services for interacting with Sitecore EE Admin API
- Async-first APIs with
CancellationTokensupport - NetStandard 2.1 for wide compatibility
- Automatic token maintenance
Getting started
Prerequisites
To work with the SDK you will require credentials which are created in the SitecoreAI Deployment Portal.
Create an Environment credential of type Edge Administration for the project and environment combination for which you wish to grant access. At this time the SDK only supports connecting to a single environment.
Install
From your project directory:
dotnet add package PINGWorks.SitecoreExperienceEdge.AdminSDK
AppSettings
Properties are available to configure the SDK through configuration binding. The snippet below shows all options along with their default values. You do not need to include values where you wish to use the defaults.
{
/* The base URL of the Admin API */
"ServiceEndpoint": "https://edge.sitecorecloud.io/api/admin/v1/",
/* The URL of the Token Request API */
"TokenEndpoint": "https://auth.sitecorecloud.io/oauth/token",
/* The auth audience */
"Audience": "https://api.sitecorecloud.io",
/* The auth grant type */
"GrantType": "client_credentials",
/* The value of ClientID from the SitecoreAI Deploy Portal */
"ClientID": "[Created in SitecoreAI Deploy portal's Credentials pane]",
/* The value of ClientSecret from the SitecoreAI Deploy Portal */
"ClientSecret": "[Created in SitecoreAI Deploy portal's Credentials pane]",
}
When creating credentials for use with the SDK, ensure that you select the Edge Administration credential type.
We recommend the use of Visual Studio's User Secrets feature to store sensitive information such as ClientId and ClientSecret during development.
Register services
Register the SDK in Program.cs, e.g. when using the minimal hosting model:
// Program.cs
var builder = WebApplication.CreateBuilder(args);
// Register SDK services - set options through binding or manually
builder.Services.AddSitecoreEEAdminSdk( opt => config.GetSection( "mySettings" ).Bind( opt ) );
HttpClient defaults. This call (via
AddSitecoreEECommon) appliesAddStandardResilienceHandler()and a DEBUG-only console request/response logger to every HttpClient in your container — not just the SDK's own. See the PINGWorks.SitecoreExperienceEdge.Common README for how to customize the resilience options per-client.
This library uses Json serialization through System.Text.Json.
Available services
Injectable interface ISitecoreAdminSdk
| Method | Description |
|---|---|
| ClearCacheForTenant() | Clears the entire cache for a given tenant. |
| DeleteContent() | Removes tenant data from the data storage. |
| GetSettings() | Lists all available settings for a tenant. |
| UpdateSettings( SettingsRequest ) | Updates all available settings for a tenant. |
| PatchSettings( params PatchRequest<SettingsRequest>[] ) | Updates a setting for a tenant using one or more Patch operations. |
| CreateWebhook( WebhookRequest ) | Creates a new webhook. |
| UpdateWebhook( string, WebhookRequest ) | Updates an existing webhook. |
| DeleteWebhook( string ) | Deletes a specific webhook. |
| ListWebhooks() | Lists all webhooks for a tenant. |
| GetWebhookById( string ) | Gets a specific tenant webhook. |
Upgrade notes
When upgrading from v1.x to v2.x you will need to change service references from IAdminSdk to ISitecoreAdminSdk.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 is compatible. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.5)
- Microsoft.Extensions.Http (>= 10.0.5)
- Microsoft.Extensions.Http.Resilience (>= 10.4.0)
- PINGWorks.SitecoreExperienceEdge.Common (>= 1.3.0)
- System.Net.Http.Json (>= 10.0.5)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
v2.2.0
✔️ Add CancellationToken support
🐛 Send correct RFC mime type for Patch requests
v2.1.1
🐛 Updated WebhookResponse as the `BodyInclude` property is sent from Sitecore as an object, not a string, for OnEnd configured webhooks
v2.1.0
✔️ Apply some missing attribute targeting attributes
✔️ Updated webhook processing
v2.0.0
🏆 Updates to work with standardised behaviours across Sitecore APIs, including Content API and Events API
🚨 IAdminSDK renamed to ISitecoreAdminSdk for better alignment with other libraries
✔️ Internal components shared with other SDKs are moved to `.Common` library
✔️ Library now has a dependency on `PINGWorks.SitecoreExperienceEdge.Common`
v1.1.0
🐛 Updated token resolver to not get stuck in an infinite loop if the credentials are not present or incorrect
v1.0.0
Initial release