contentstack.csharp 2.13.0

dotnet add package contentstack.csharp --version 2.13.0
NuGet\Install-Package contentstack.csharp -Version 2.13.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="contentstack.csharp" Version="2.13.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add contentstack.csharp --version 2.13.0
#r "nuget: contentstack.csharp, 2.13.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install contentstack.csharp as a Cake Addin
#addin nuget:?package=contentstack.csharp&version=2.13.0

// Install contentstack.csharp as a Cake Tool
#tool nuget:?package=contentstack.csharp&version=2.13.0

Contentstack

Contentstack dotnet

.NET SDK for Contentstack's Content Delivery API

Getting Started

This guide will help you get started with our .NET SDK to build apps powered by Contentstack.

SDK Installation and Setup

To use the .NET SDK, download it from here

Open the terminal and install the contentstack module via ‘Package Manager’ command

PM> Install-Package contentstack.csharp

And via ‘.Net CLI’

dotnet add package contentstack.csharp

To use the module in your application, you need to first Add Namespace to your class

using Contentstack.Core; // ContentstackClient 
using Contentstack.Core.Models; // Stack, Query, Entry, Asset, ContentType, ContentstackCollection
using Contentstack.Core.Configuration; // ContentstackOptions

Initialize SDK

You will need to specify the API key, Access token, and Environment Name of your stack to initialize the SDK:

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "enviroment_name");

or:

var options = new ContentstackOptions()
{
    ApiKey = "<api_key>",
    DeliveryToken = "<delivery_token>"
    Environment = "<environment>"
}
ContentstackClient stack = new ContentstackClient(options);

Once you have initialized the SDK, you can start getting content in your app.

Basic Queries

Get a Single Entry

To retrieve a single entry from a content type, use the code snippet given below:

Entry entry = client.ContentType("product").Entry("blta464e9fbd048668c");
entry.Fetch<Product>().ContinueWith((t) => { 
    if (!t.IsFaulted) { 
        Console.WriteLine("entry:" + t.Result);  
    } 
});

Get Multiple Entries

To retrieve multiple entries of a particular content type, use the code snippet given below:

Query query = client.ContentType("product").Query(); 
query.Where("title", "welcome"); 
query.IncludeSchema(); 
query.IncludeCount(); 
query.ToJSON(); 
query.Find<Product>().ContinueWith((t) => { 
    if (!t.IsFaulted) { 
         ContentstackCollection<Product> result = t.Result; 
         Console.WriteLine("result" + result.items); 
    } 
});

These were example of some of the basic queries of the SDK. For advanced queries, refer to our API reference documentation by visiting the link given below.

Note: Currently, the .NET SDK does not support multiple content types referencing in a single query. For more information on how to query entries and assets, refer the Queries section of our Content Delivery API documentation.

Paginating Responses

In a single instance, the Get Multiple Entries query will retrieve only the first 100 items of the specified content type. You can paginate and retrieve the rest of the items in batches using the skip and limit parameters in subsequent requests.

Query query = client.ContentType("product").Query();
query.Skip(20);
query.Limit(20); 
query.Find<Product>().ContinueWith((t) => { 
    if (!t.IsFaulted) { 
         ContentstackCollection<Product> result = t.Result; 
         Console.WriteLine("result" + result); 
    } 
});

API Reference

Go through our .NET SDK API Reference guide to know about the methods that can be used to query your content in Contentstack.

Read .NET API Reference Guide

Example

To help you get started, we have created a sample application that is powered by Contentstack .NET SDK. Click on the link below to read the tutorial of the app.

.NET News Console App

Product 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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 is compatible.  net471 was computed.  net472 is compatible.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on contentstack.csharp:

Package Downloads
contentstack.aspnetcore

Main release

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.13.0 0 4/19/2024
2.12.0 680 2/2/2024
2.11.0 63,635 9/27/2023
2.10.0 21,176 3/8/2023
2.9.0 41,135 9/9/2022
2.8.0 119,526 1/14/2022
2.7.0 3,654 12/8/2021
2.6.2 4,820 7/16/2021
2.6.1 5,685 4/9/2021
2.6.0 794 4/6/2021
2.5.0 3,808 12/5/2020
2.4.1-alpha 789 11/11/2020
2.4.0 10,647 8/12/2020
2.3.0 1,573 6/22/2020
2.2.1 22,100 2/17/2020
2.2.0 1,072 11/15/2019
2.1.1 2,442 9/3/2019
2.1.0 1,186 7/29/2019
2.0.0 1,335 6/28/2019
1.1.0 14,117 4/12/2019
1.0.6 3,191 8/10/2018
1.0.5-alpha 1,478 5/31/2018
1.0.4-alpha 2,538 5/31/2018
1.0.3-alpha 2,735 5/30/2018
1.0.2-alpha 1,375 5/29/2018
1.0.1-alpha 1,291 5/29/2018
1.0.0 1,770 6/1/2018

Reference in entry Live preview support added