Kontent.Ai.Delivery
17.2.0
See the version list below for details.
dotnet add package Kontent.Ai.Delivery --version 17.2.0
NuGet\Install-Package Kontent.Ai.Delivery -Version 17.2.0
<PackageReference Include="Kontent.Ai.Delivery" Version="17.2.0" />
paket add Kontent.Ai.Delivery --version 17.2.0
#r "nuget: Kontent.Ai.Delivery, 17.2.0"
// Install Kontent.Ai.Delivery as a Cake Addin #addin nuget:?package=Kontent.Ai.Delivery&version=17.2.0 // Install Kontent.Ai.Delivery as a Cake Tool #tool nuget:?package=Kontent.Ai.Delivery&version=17.2.0
Kontent.ai Delivery .NET SDK
Paradigm | Package | Downloads | Compatibility | Documentation |
---|---|---|---|---|
Async | net6.0 |
📖 Wiki | ||
Reactive | net6.0 |
📖 Wiki |
Summary
The Kontent.ai Delivery .NET SDK is a client library that lets you easily retrieve content from Kontent.ai.
Getting started
Installation via Package Manager Console in Visual Studio:
PM> Install-Package Kontent.Ai.Delivery
Installation via .NET CLI:
> dotnet add <TARGET PROJECT> package Kontent.Ai.Delivery
Usage
To retrieve content from your Kontent.ai projects, you'll be using an implementation of the IDeliveryClient
interface. This is the main interface of the SDK. Here's how you can instantiate and use the Delivery client either with DI/IoC or without DI/IoC.
Use dependency injection (ideal for ASP.NET Core web apps)
Startup.cs
public void ConfigureServices(IServiceCollection services)
{
services.AddDeliveryClient(Configuration);
}
HomeController.cs
public class HomeController
{
private IDeliveryClient _client;
public HomeController(IDeliveryClient deliveryClient)
{
_client = deliveryClient;
}
}
In this case, the SDK reads the configuration from the DeliveryOptions
section of the Configuration
object. There are many ways of providing the configuration to the DeliveryClient
as well as many advanced registration scenarios which you can all find in the Wiki.
To see a complete working example, go to one of our sample apps:
To spin up a fully configured blank site quickly, use the:
Usage without IoC/DI containers (ideal for console apps, unit tests...)
You can also set up a DeliveryOptions
manually using the DeliveryClientBuilder
.
IDeliveryClient _client = DeliveryClientBuilder
.WithOptions(builder => builder
.WithProjectId("<YOUR_PROJECT_ID>")
.UseProductionApi()
.Build())
.Build();
Your first request
Use the .NET code generator to generate POCO models:
public class Article
{
public string Title { get; set; }
public string Summary { get; set; }
public string Body { get; set; }
public DateTime? PostDate { get; set; }
public ContentItemSystemAttributes System { get; set; }
}
Call the IDeliveryClient
to retrieve data from Kontent:
// Retrieving a single content item
var response = await _client.GetItemAsync<Article>("<article_codename>");
var title = response.Item.Title; // -> "On Roasts"
var lang = response.Item.System.Language; // -> "en-US"
See Working with Strongly Typed Models to learn how to generate models and adjust the logic to your needs.
Further information
For more developer resources, visit:
- ✔️ Best practices for Kontent.ai Delivery SDK for .NET
- Kontent.ai Learn:
Get involved
Check out the contributing page to see the best places to file issues, start discussions, and begin contributing.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. 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. |
-
net6.0
- AngleSharp (>= 0.17.1)
- Kontent.Ai.Delivery.Abstractions (>= 17.2.0)
- Kontent.Ai.Urls (>= 17.2.0)
- Microsoft.AspNetCore.WebUtilities (>= 2.2.0)
- Microsoft.Extensions.Caching.Abstractions (>= 6.0.0)
- Microsoft.Extensions.Caching.Memory (>= 6.0.1)
- Microsoft.Extensions.Configuration (>= 6.0.1)
- Microsoft.Extensions.Configuration.Binder (>= 6.0.0)
- Microsoft.Extensions.DependencyInjection (>= 6.0.0)
- Microsoft.Extensions.Options (>= 6.0.0)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 6.0.0)
- Newtonsoft.Json (>= 13.0.1)
- Scrutor (>= 4.2.0)
- System.ComponentModel.Annotations (>= 5.0.0)
NuGet packages (4)
Showing the top 4 NuGet packages that depend on Kontent.Ai.Delivery:
Package | Downloads |
---|---|
Kontent.Ai.Delivery.Extensions.DependencyInjection
Kontent.ai Delivery Extensions Autofac Dependency Injection |
|
Kontent.Ai.ModelGenerator.Core
This utility generates strongly-typed models based on content-types in a Kontent.ai project. The models are supposed to be used together with the Kontent.ai Delivery SDK for .NET or Kontent.ai Management SDK for .NET. Please read the documentation to see all benefits of this approach. |
|
Kontent.Statiq
Kentico Kontent module for Statiq. Fetch content and assets from Kontent headless CMS. |
|
Kontent.Ai.Delivery.Rx
Kontent.ai Delivery SDK |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
18.1.0 | 31,314 | 3/6/2024 |
18.0.0 | 893 | 2/27/2024 |
17.9.0 | 26,725 | 12/12/2023 |
17.8.0 | 3,735 | 10/31/2023 |
17.7.0 | 7,777 | 8/4/2023 |
17.7.0-beta.0 | 87 | 5/9/2023 |
17.6.0 | 9,438 | 4/21/2023 |
17.5.0 | 25,520 | 3/16/2023 |
17.4.0 | 827 | 3/9/2023 |
17.3.0 | 1,826 | 3/2/2023 |
17.2.0 | 5,874 | 2/2/2023 |
17.2.0-beta.1 | 119 | 1/19/2023 |
17.1.0 | 16,857 | 1/9/2023 |
17.0.1 | 81,723 | 11/10/2022 |
17.0.0 | 17,112 | 8/3/2022 |
17.0.0-beta.2 | 156 | 7/29/2022 |
17.0.0-beta.1 | 128 | 7/28/2022 |